diff lib/js/urweb.js @ 1681:e8a84494d2c0

Fix runtime system handling of <dyn> inside <table> inside <dyn>
author Adam Chlipala <adam@chlipala.net>
date Sun, 22 Jan 2012 20:25:14 -0500
parents d05299e561c8
children 225b87d4a7df
line wrap: on
line diff
--- a/lib/js/urweb.js	Sun Jan 15 14:45:06 2012 -0500
+++ b/lib/js/urweb.js	Sun Jan 22 20:25:14 2012 -0500
@@ -699,10 +699,15 @@
 
     for (var tbody = table.firstChild; tbody; tbody = tbody.nextSibling) {
         if (tbody.tagName == "TBODY") {
+            var firstChild = tbody.firstChild;
+
             for (script = table.firstChild; script && script != tbody; script = next) {
                 next = script.nextSibling;
 
-                tbody.insertBefore(script, tbody.firstChild);
+                if (firstChild)
+                    tbody.insertBefore(script, firstChild);
+                else
+                    tbody.appendChild(script);
             }
 
             return;
@@ -713,7 +718,7 @@
     for (script = table.firstChild; script; script = next) {
         next = script.nextSibling;
 
-        tbody.insertBefore(script, tbody.firstChild);
+        tbody.appendChild(script);
     }
     table.appendChild(tbody);
 }