# HG changeset patch # User Adam Chlipala # Date 1249583943 14400 # Node ID 4b9f1de2c647db18f58a51690e12d0e1fb735174 # Parent f17638dd30809136e7e781beaa5cd4aaf63e772c dlist add and delete both working in Iceape and Konqueror diff -r f17638dd3080 -r 4b9f1de2c647 lib/js/urweb.js --- a/lib/js/urweb.js Thu Aug 06 14:24:40 2009 -0400 +++ b/lib/js/urweb.js Thu Aug 06 14:39:03 2009 -0400 @@ -269,13 +269,15 @@ 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 @@ 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); } };