diff src/monoize.sml @ 1290:6791454653c5

Confirm boxes; proper event handler setting for ctags
author Adam Chlipala <adam@chlipala.net>
date Sun, 22 Aug 2010 19:45:07 -0400
parents fc7ecf8883b1
children a671c986f517
line wrap: on
line diff
--- a/src/monoize.sml	Sun Aug 22 13:43:46 2010 -0400
+++ b/src/monoize.sml	Sun Aug 22 19:45:07 2010 -0400
@@ -2958,7 +2958,7 @@
                                                   L'.TRecord [] => ((L'.EApp (e, (L'.ERecord [], loc)), loc), s')
                                                 | _ => ((L'.EApp ((L'.EApp (e, (L'.EFfiApp ("Basis", "kc", []), loc)),
                                                                    loc), (L'.ERecord [], loc)), loc),
-                                                        s' ^ "uwe=event;")
+                                                        s' ^ "uw_event=event;")
                                           val s' = s' ^ "exec("
                                       in
                                           ((L'.EStrcat (s,
@@ -3068,10 +3068,27 @@
                                          SOME (strcat [str "addOnChange(d,exec(",
                                                        (L'.EJavaScript (L'.Script, e), loc),
                                                        str "))"])
-                                       | (x, e, _) =>
+                                       | (x, e, (L'.TFun ((L'.TRecord [], _), _), _)) =>
                                          SOME (strcat [str ("d." ^ lowercaseFirst x ^ "=exec("),
                                                        (L'.EJavaScript (L'.Script, e), loc),
-                                                       str ");"]))
+                                                       str ");"])
+                                       | (x, e, _) =>
+                                         let
+                                             val e = (L'.EAbs ("_", (L'.TRecord [], loc), (L'.TRecord [], loc),
+                                                               (L'.EApp ((L'.EApp (liftExpInExp 0 e,
+                                                                                   (L'.EFfiApp ("Basis", "kc", []), loc)),
+                                                                          loc), (L'.ERecord [], loc)), loc)), loc)
+                                         in
+                                             case x of
+                                                 "Onkeyup" =>
+                                                 SOME (strcat [str ("((function(c){addOnKeyUp(d,function(){window.uw_event=window.event;return c();});})(exec("),
+                                                               (L'.EJavaScript (L'.Script, e), loc),
+                                                               str ")));"])
+                                               | _ =>
+                                                 SOME (strcat [str ("((function(c){d." ^ lowercaseFirst x ^ "=function(){window.uw_event=window.event;return c();};})(exec("),
+                                                               (L'.EJavaScript (L'.Script, e), loc),
+                                                               str ")));"])
+                                         end)
                                      attrs
 
                         val t = (L'.TFfi ("Basis", "string"), loc)