summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/js/urweb.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/js/urweb.js b/lib/js/urweb.js
index adab5f43..b557147b 100644
--- a/lib/js/urweb.js
+++ b/lib/js/urweb.js
@@ -699,10 +699,15 @@ function normalizeTable(table) {
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 @@ function normalizeTable(table) {
for (script = table.firstChild; script; script = next) {
next = script.nextSibling;
- tbody.insertBefore(script, tbody.firstChild);
+ tbody.appendChild(script);
}
table.appendChild(tbody);
}