Mercurial > urweb
annotate tests/data_attr.ur @ 2008:93ff76058825
HTML5 data-* attributes
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Fri, 02 May 2014 15:32:10 -0400 |
parents | |
children | 6be31671911b |
rev | line source |
---|---|
adam@2008 | 1 fun dynd r = return <xml><body> |
adam@2008 | 2 <div data={data_attr r.Attr r.Value}>How about that?</div> |
adam@2008 | 3 </body></xml> |
adam@2008 | 4 |
adam@2008 | 5 fun main () : transaction page = |
adam@2008 | 6 s <- source <xml/>; |
adam@2008 | 7 a <- source ""; |
adam@2008 | 8 v <- source ""; |
adam@2008 | 9 return <xml><body> |
adam@2008 | 10 <div data-foo="hi" data-bar="bye" data-baz="why">Whoa there, cowboy!</div> |
adam@2008 | 11 |
adam@2008 | 12 <hr/> |
adam@2008 | 13 |
adam@2008 | 14 <form> |
adam@2008 | 15 <textbox{#Attr}/> = <textbox{#Value}/> |
adam@2008 | 16 <submit action={dynd}/> |
adam@2008 | 17 </form> |
adam@2008 | 18 |
adam@2008 | 19 <hr/> |
adam@2008 | 20 |
adam@2008 | 21 <ctextbox source={a}/> = <ctextbox source={v}/> |
adam@2008 | 22 <button onclick={fn _ => |
adam@2008 | 23 a <- get a; v <- get v; set s <xml><div data={data_attr a v}>OHO!</div></xml>}/> |
adam@2008 | 24 <hr/> |
adam@2008 | 25 <dyn signal={signal s}/> |
adam@2008 | 26 </body></xml> |