changeset 1610:37f5a23446b2

Catch more <ccheckbox> events
author Adam Chlipala <adam@chlipala.net>
date Thu, 24 Nov 2011 11:41:52 -0500 (2011-11-24)
parents c6cc104a47ac
children 217384f4b8ea
files lib/js/urweb.js tests/ccheckbox.ur
diffstat 2 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lib/js/urweb.js	Thu Nov 24 11:27:51 2011 -0500
+++ b/lib/js/urweb.js	Thu Nov 24 11:41:52 2011 -0500
@@ -894,7 +894,7 @@
     var x = input(document.createElement("input"), s,
                   function(x) { return function(v) { if (x.checked != v) x.checked = v; }; }, "checkbox");
     x.defaultChecked = x.checked = s.data;
-    x.onclick = function() { sv(s, x.checked) };
+    x.onclick = x.onkeyup = x.oninput = x.onchange = x.onpropertychange = function() { sv(s, x.checked) };
 
     return x;
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/ccheckbox.ur	Thu Nov 24 11:41:52 2011 -0500
@@ -0,0 +1,8 @@
+fun main () : transaction page =
+    s <- source True;
+    t <- source 1;
+    return <xml><body><ccheckbox source={s} onclick={set t 3}/>
+      <dyn signal={s <- signal s;
+                   t <- signal t;
+                   return <xml>{[s]} {[t]}</xml>}/>
+    </body></xml>