aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/monoize.sml
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-06-13 14:29:36 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-06-13 14:29:36 -0400
commitba3e01e524907d85f5cba6af62083fcdee606f33 (patch)
tree1f400f83f20ef1f54d68e1e7b674a08f29abb4d4 /src/monoize.sml
parentb7de8e9ac590f9d06df72d22489375b33a6efef9 (diff)
<dyn> inside <table>; fix Specialize bug with datatype decls generating other mutually-recursive datatype decls
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)