diff options
author | 2009-08-06 14:39:03 -0400 | |
---|---|---|
committer | 2009-08-06 14:39:03 -0400 | |
commit | 8e40f70890e42ca4ebf9ae070712798ecdc217f0 (patch) | |
tree | f8b4c25ea68fe886e2e4c186e20a21cf1c2fb7eb | |
parent | e5346fa5af27c6546bdbb3d9de6180b07aa0195e (diff) |
dlist add and delete both working in Iceape and Konqueror
-rw-r--r-- | lib/js/urweb.js | 19 |
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); } }; |