diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/data_attr.ur	Fri May 02 15:32:10 2014 -0400
@@ -0,0 +1,26 @@
+fun dynd r = return <xml><body>
+  <div data={data_attr r.Attr r.Value}>How about that?</div>
+</body></xml>
+
+fun main () : transaction page =
+  s <- source <xml/>;
+  a <- source "";
+  v <- source "";
+  return <xml><body>
+    <div data-foo="hi" data-bar="bye" data-baz="why">Whoa there, cowboy!</div>
+
+    <hr/>
+
+    <form>
+      <textbox{#Attr}/> = <textbox{#Value}/>
+      <submit action={dynd}/>
+    </form>
+
+    <hr/>
+
+    <ctextbox source={a}/> = <ctextbox source={v}/>
+    <button onclick={fn _ =>
+      a <- get a; v <- get v; set s <xml><div data={data_attr a v}>OHO!</div></xml>}/>
+    <hr/>
+    <dyn signal={signal s}/>
+  </body></xml>