comparison src/monoize.sml @ 1789:2e01a36701eb

Fix bug in handling of event attributes within client-side widgets
author Adam Chlipala <adam@chlipala.net>
date Sat, 21 Jul 2012 21:07:15 -0400
parents d794149b3713
children 3d922a28370b
comparison
equal deleted inserted replaced
1788:f57983ba2a36 1789:2e01a36701eb
3439 (L'.EJavaScript (L'.Script, e), loc), 3439 (L'.EJavaScript (L'.Script, e), loc),
3440 str ");"]) 3440 str ");"])
3441 | (x, e, _) => 3441 | (x, e, _) =>
3442 if String.isPrefix "On" x then 3442 if String.isPrefix "On" x then
3443 let 3443 let
3444 val arg = if String.isPrefix "Onkey" x then
3445 SOME (L'.EFfiApp ("Basis", "keyEvent", []), loc)
3446 else if String.isSuffix "click" x orelse String.isPrefix "Onmouse" x then
3447 SOME (L'.EFfiApp ("Basis", "mouseEvent", []), loc)
3448 else
3449 NONE
3450
3451 val e = liftExpInExp 0 e
3452
3453 val e = case arg of
3454 NONE => e
3455 | SOME arg => (L'.EApp (e, arg), loc)
3456
3444 val e = (L'.EAbs ("_", (L'.TRecord [], loc), (L'.TRecord [], loc), 3457 val e = (L'.EAbs ("_", (L'.TRecord [], loc), (L'.TRecord [], loc),
3445 (L'.EApp ((L'.EApp (liftExpInExp 0 e, 3458 (L'.EApp (e, (L'.ERecord [], loc)), loc)), loc)
3446 (L'.EFfiApp ("Basis", "kc", []), loc)),
3447 loc), (L'.ERecord [], loc)), loc)), loc)
3448 in 3459 in
3449 case x of 3460 case x of
3450 "Onkeyup" => 3461 "Onkeyup" =>
3451 SOME (strcat [str ("((function(c){addOnKeyUp(d,function(ev){window.uw_event=ev?ev:window.event;return c();});})(exec("), 3462 SOME (strcat [str ("((function(c){addOnKeyUp(d,function(ev){window.uw_event=ev?ev:window.event;return c();});})(exec("),
3452 (L'.EJavaScript (L'.Script, e), loc), 3463 (L'.EJavaScript (L'.Script, e), loc),