comparison lib/js/urweb.js @ 902:4b9f1de2c647

dlist add and delete both working in Iceape and Konqueror
author Adam Chlipala <adamc@hcoop.net>
date Thu, 06 Aug 2009 14:39:03 -0400
parents f17638dd3080
children 63114a2e5075
comparison
equal deleted inserted replaced
901:f17638dd3080 902:4b9f1de2c647
267 x.dead = false; 267 x.dead = false;
268 x.signal = s; 268 x.signal = s;
269 x.sources = null; 269 x.sources = null;
270 x.closures = null; 270 x.closures = null;
271 271
272 var child = null; 272 var firstChild = null;
273 273
274 x.recreate = function(v) { 274 x.recreate = function(v) {
275 for (var ls = x.closures; ls; ls = ls.next) 275 for (var ls = x.closures; ls; ls = ls.next)
276 freeClosure(ls.data); 276 freeClosure(ls.data);
277 277
278 if (child) { 278 var next;
279 for (var child = firstChild; child && child != x; child = next) {
280 next = child.nextSibling;
279 if (child.getElementsByTagName) { 281 if (child.getElementsByTagName) {
280 var arr = child.getElementsByTagName("script"); 282 var arr = child.getElementsByTagName("script");
281 for (var i = 0; i < arr.length; ++i) { 283 for (var i = 0; i < arr.length; ++i) {
282 var span = arr[i]; 284 var span = arr[i];
283 span.dead = true; 285 span.dead = true;
303 var rows = dummy.firstChild.rows; 305 var rows = dummy.firstChild.rows;
304 var nRows = rows.length; 306 var nRows = rows.length;
305 var table = x.parentNode; 307 var table = x.parentNode;
306 308
307 var arr = dummy.getElementsByTagName("tbody"); 309 var arr = dummy.getElementsByTagName("tbody");
310 firstChild = null;
308 if (arr.length > 0) { 311 if (arr.length > 0) {
309 var tbody = arr[0], next; 312 var tbody = arr[0], next;
313 firstChild = document.createElement("script");
314 table.insertBefore(firstChild, x);
310 for (var node = tbody.firstChild; node; node = next) { 315 for (var node = tbody.firstChild; node; node = next) {
311 next = node.nextSibling; 316 next = node.nextSibling;
312 table.appendChild(node); 317 table.insertBefore(node, x);
313 } 318 }
314 } 319 }
315 } else { 320 } else {
316 child = document.createElement("span"); 321 firstChild = document.createElement("span");
317 child.innerHTML = html; 322 firstChild.innerHTML = html;
318 runScripts(child); 323 runScripts(firstChild);
319 if (x.parentNode) 324 if (x.parentNode)
320 x.parentNode.insertBefore(child, x); 325 x.parentNode.insertBefore(firstChild, x);
321 } 326 }
322 }; 327 };
323 328
324 addNode(x); 329 addNode(x);
325 populate(x); 330 populate(x);