From 1d6456fbf525b34cdf91fe8de305b398171109ee Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Thu, 6 Aug 2009 14:39:03 -0400 Subject: dlist add and delete both working in Iceape and Konqueror --- lib/js/urweb.js | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'lib') 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); } }; -- cgit v1.2.3