changeset 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 5b2c7b9f6017
children ac141fbb313a
files lib/js/urweb.js
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
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);
 }