diff options
author | Adam Chlipala <adamc@hcoop.net> | 2008-12-21 12:01:00 -0500 |
---|---|---|
committer | Adam Chlipala <adamc@hcoop.net> | 2008-12-21 12:01:00 -0500 |
commit | 0a3abbb2250da6464e91566a1f275829158d3058 (patch) | |
tree | 6e44efd218647699174febb6c13df253cb6c582b | |
parent | 65428eeb2cba9807043188bfddf5fbfd1bf9296b (diff) |
Switch to using dyn() function in JavaScript
-rw-r--r-- | jslib/urweb.js | 6 | ||||
-rw-r--r-- | src/monoize.sml | 14 |
2 files changed, 10 insertions, 10 deletions
diff --git a/jslib/urweb.js b/jslib/urweb.js index 32912e4c..b7a1af91 100644 --- a/jslib/urweb.js +++ b/jslib/urweb.js @@ -1 +1,7 @@ function sreturn(v) { return {v : v} } + +function dyn(s) { + var x = document.createElement("span"); + x.innerHTML = s.v; + document.body.appendChild(x); +} diff --git a/src/monoize.sml b/src/monoize.sml index a0a0df30..63d84d8c 100644 --- a/src/monoize.sml +++ b/src/monoize.sml @@ -1850,20 +1850,14 @@ fun monoExp (env, st, fm) (all as (e, loc)) = | "dyn" => (case #1 attrs of - (*L'.ERecord [("Signal", (L'.ESignalReturn e, _), _)] => (e, fm) - | L'.ERecord [("Signal", (L'.EApp ((L'.EAbs (_, _, _, (L'.ESignalReturn (L'.ERel 0, _), _)), _), + (*L'.ERecord [("Signal", (L'.EApp ((L'.EAbs (_, _, _, (L'.ESignalReturn (L'.ERel 0, _), _)), _), e), _), _)] => (e, fm) *) L'.ERecord [("Signal", e, _)] => ((L'.EStrcat - ((L'.EPrim (Prim.String "<script type=\"text/javascript\">"), loc), - (L'.EStrcat ((L'.EJavaScript (L'.Script, - (L'.ELet ("signal", (L'.TSignal - (L'.TFfi ("Basis", "string"), loc), - loc), - e, - (L'.EWrite (L'.ERel 0, loc), loc)), loc)), loc), - (L'.EPrim (Prim.String "</script>"), loc)), loc)), loc), + ((L'.EPrim (Prim.String "<script type=\"text/javascript\">dyn("), loc), + (L'.EStrcat ((L'.EJavaScript (L'.Script, e), loc), + (L'.EPrim (Prim.String ")</script>"), loc)), loc)), loc), fm) | _ => raise Fail "Monoize: Bad dyn attributes") |