diff src/monoize.sml @ 901:f17638dd3080

dlist row add working with Konqueror
author Adam Chlipala <adamc@hcoop.net>
date Thu, 06 Aug 2009 14:24:40 -0400
parents 25a038a9194b
children 63114a2e5075
line wrap: on
line diff
--- a/src/monoize.sml	Thu Aug 06 11:58:38 2009 -0400
+++ b/src/monoize.sml	Thu Aug 06 14:24:40 2009 -0400
@@ -2644,14 +2644,28 @@
                     end
 
                   | "dyn" =>
-                    (case attrs of
-                         [("Signal", e, _)] =>
-                         ((L'.EStrcat
-                               ((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")
+                    let
+                        val inTable = case targs of
+                                          (L.CRecord (_, ctx), _) :: _ =>
+                                          List.exists (fn ((L.CName "Table", _), _) => true
+                                                        | _ => false) ctx
+                                        | _ => false
+                                               
+                        val tag = if inTable then
+                                      "table"
+                                  else
+                                      "span"
+                    in
+                        case attrs of
+                            [("Signal", e, _)] =>
+                            ((L'.EStrcat
+                                  ((L'.EPrim (Prim.String ("<script type=\"text/javascript\">dyn(\""
+                                                           ^ tag ^ "\", ")), loc),
+                                   (L'.EStrcat ((L'.EJavaScript (L'.Script, e), loc),
+                                                (L'.EPrim (Prim.String (")</script>")), loc)), loc)), loc),
+                             fm)
+                          | _ => raise Fail "Monoize: Bad dyn attributes"
+                    end
                     
                   | "submit" => normal ("input type=\"submit\"", NONE, NONE)
                   | "button" => normal ("input type=\"submit\"", NONE, NONE)