summaryrefslogtreecommitdiff
path: root/lib/js/urweb.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/js/urweb.js')
-rw-r--r--lib/js/urweb.js19
1 files changed, 12 insertions, 7 deletions
diff --git a/lib/js/urweb.js b/lib/js/urweb.js
index 06ff19cf..84dcd7e2 100644
--- a/lib/js/urweb.js
+++ b/lib/js/urweb.js
@@ -269,13 +269,15 @@ function dyn(pnode, s) {
x.sources = null;
x.closures = null;
- var child = null;
+ var firstChild = null;
x.recreate = function(v) {
for (var ls = x.closures; ls; ls = ls.next)
freeClosure(ls.data);
- if (child) {
+ var next;
+ for (var child = firstChild; child && child != x; child = next) {
+ next = child.nextSibling;
if (child.getElementsByTagName) {
var arr = child.getElementsByTagName("script");
for (var i = 0; i < arr.length; ++i) {
@@ -305,19 +307,22 @@ function dyn(pnode, s) {
var table = x.parentNode;
var arr = dummy.getElementsByTagName("tbody");
+ firstChild = null;
if (arr.length > 0) {
var tbody = arr[0], next;
+ firstChild = document.createElement("script");
+ table.insertBefore(firstChild, x);
for (var node = tbody.firstChild; node; node = next) {
next = node.nextSibling;
- table.appendChild(node);
+ table.insertBefore(node, x);
}
}
} else {
- child = document.createElement("span");
- child.innerHTML = html;
- runScripts(child);
+ firstChild = document.createElement("span");
+ firstChild.innerHTML = html;
+ runScripts(firstChild);
if (x.parentNode)
- x.parentNode.insertBefore(child, x);
+ x.parentNode.insertBefore(firstChild, x);
}
};