comparison lib/js/urweb.js @ 900:ed381288ce9a

Tweaking dyn() implementation to get grid working
author Adam Chlipala <adamc@hcoop.net>
date Thu, 06 Aug 2009 11:58:38 -0400
parents 25a038a9194b
children f17638dd3080
comparison
equal deleted inserted replaced
899:25a038a9194b 900:ed381288ce9a
289 } 289 }
290 } 290 }
291 291
292 var old = node; 292 var old = node;
293 node = node.nextSibling; 293 node = node.nextSibling;
294 old.parentNode.removeChild(old); 294 if (old.parentNode)
295 old.parentNode.removeChild(old);
295 } 296 }
296 297
297 var cls = {v : null}; 298 var cls = {v : null};
298 var dummy = document.createElement("table"); 299 var dummy = document.createElement("table");
299 dummy.innerHTML = flatten(cls, v); 300 dummy.innerHTML = flatten(cls, v);
302 303
303 for (first = dummy.firstChild; first && first.tagName == "TBODY"; first = first.firstChild); 304 for (first = dummy.firstChild; first && first.tagName == "TBODY"; first = first.firstChild);
304 for (var node = first; node; ) { 305 for (var node = first; node; ) {
305 var old = node; 306 var old = node;
306 node = node.nextSibling; 307 node = node.nextSibling;
307 x.parentNode.insertBefore(old, x); 308 if (x.parentNode)
309 x.parentNode.insertBefore(old, x);
308 } 310 }
309 }; 311 };
310 312
311 addNode(x); 313 addNode(x);
312 populate(x); 314 populate(x);