Mercurial > urweb
diff tests/dynClass.ur @ 1643:b0720700c36e
'dynClass' pseudo-attribute
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Tue, 27 Dec 2011 16:20:48 -0500 |
parents | |
children | acadf9d1214a |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/dynClass.ur Tue Dec 27 16:20:48 2011 -0500 @@ -0,0 +1,21 @@ +style s1 +style s2 + +fun main () : transaction page = + src <- source s1; + s <- source ""; + toggle <- source False; + return <xml> + <head> + <link rel="stylesheet" type="text/css" href="http://localhost/test.css"/> + </head> + <body> + <button dynClass={signal src} onclick={set src s2}/> + + <hr/> + + <ctextbox source={s} dynClass={t <- signal toggle; + return (if t then s1 else s2)} + onkeyup={fn _ => t <- get toggle; set toggle (not t)}/> + </body> + </xml>