From 912c6fcf0c09348965262dd13c8faaefa61c2999 Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Sun, 22 Jan 2012 20:25:14 -0500 Subject: Fix runtime system handling of inside inside --- lib/js/urweb.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'lib/js') 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); } -- cgit v1.2.3