comparison tests/dynClass.ur @ 1751:acadf9d1214a

'dynStyle' pseudo-attribute
author Adam Chlipala <adam@chlipala.net>
date Sun, 06 May 2012 15:15:46 -0400
parents b0720700c36e
children 2b2d07946e65
comparison
equal deleted inserted replaced
1750:277480862cef 1751:acadf9d1214a
1 style s1 1 style date
2 style s2 2 style topic
3 3
4 fun main () : transaction page = 4 fun main () : transaction page =
5 src <- source s1;
6 s <- source "";
7 toggle <- source False; 5 toggle <- source False;
8 return <xml> 6 return <xml>
9 <head> 7 <head>
10 <link rel="stylesheet" type="text/css" href="http://localhost/test.css"/> 8 <link rel="stylesheet" type="text/css" href="http://adam.chlipala.net/style.css"/>
11 </head> 9 </head>
12 <body> 10 <body>
13 <button dynClass={signal src} onclick={set src s2}/> 11 <button dynClass={b <- signal toggle;
12 return (if b then date else topic)}
13 dynStyle={b <- signal toggle;
14 return (if b then
15 STYLE "width: 500px"
16 else
17 STYLE "width: 200px")}
18 onclick={b <- get toggle; set toggle (not b)}/>
14 19
15 <hr/> 20 <button dynStyle={b <- signal toggle;
16 21 return (if b then
17 <ctextbox source={s} dynClass={t <- signal toggle; 22 STYLE "width: 200px"
18 return (if t then s1 else s2)} 23 else
19 onkeyup={fn _ => t <- get toggle; set toggle (not t)}/> 24 STYLE "width: 100px")}/>
25 <button dynClass={b <- signal toggle;
26 return (if b then
27 topic
28 else
29 date)}/>
20 </body> 30 </body>
21 </xml> 31 </xml>