aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/monoize.sml
diff options
context:
space:
mode:
Diffstat (limited to 'src/monoize.sml')
-rw-r--r--src/monoize.sml23
1 files changed, 18 insertions, 5 deletions
diff --git a/src/monoize.sml b/src/monoize.sml
index d3eb4874..91160e02 100644
--- a/src/monoize.sml
+++ b/src/monoize.sml
@@ -2595,11 +2595,24 @@ fun monoExp (env, st, fm) (all as (e, loc)) =
| "dyn" =>
(case attrs of
[("Signal", e, _)] =>
- ((L'.EStrcat
- ((L'.EPrim (Prim.String "<span><script type=\"text/javascript\">dyn("), loc),
- (L'.EStrcat ((L'.EJavaScript (L'.Script, e), loc),
- (L'.EPrim (Prim.String ")</script></span>"), loc)), loc)), loc),
- fm)
+ let
+ val inTable = case targs of
+ (L.CRecord (_, ctx), _) :: _ =>
+ List.exists (fn ((L.CName "Table", _), _) => true
+ | _ => false) ctx
+ | _ => false
+
+ val tag = if inTable then
+ "tbody"
+ else
+ "span"
+ in
+ ((L'.EStrcat
+ ((L'.EPrim (Prim.String ("<" ^ tag ^ "><script type=\"text/javascript\">dyn(")), loc),
+ (L'.EStrcat ((L'.EJavaScript (L'.Script, e), loc),
+ (L'.EPrim (Prim.String (")</script></" ^ tag ^ ">")), loc)), loc)), loc),
+ fm)
+ end
| _ => raise Fail "Monoize: Bad dyn attributes")
| "submit" => normal ("input type=\"submit\"", NONE, NONE)