From 94a1373401529f500640b0c0628e7173612cdabe Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Sun, 19 Jul 2009 17:45:02 -0400 Subject: Working on Grid; have gone from one dynamic table bizareness to another --- lib/js/urweb.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'lib/js') diff --git a/lib/js/urweb.js b/lib/js/urweb.js index 3d4dbea2..dd66b55e 100644 --- a/lib/js/urweb.js +++ b/lib/js/urweb.js @@ -223,12 +223,17 @@ function lastParent() { return pos.parentNode; } +function parent() { + return thisScript ? thisScript.parentNode : lastParent(); +} + function addNode(node) { if (thisScript) { thisScript.parentNode.appendChild(node); thisScript.parentNode.removeChild(thisScript); - } else + } else { lastParent().appendChild(node); + } } function setHTML(html) { @@ -266,10 +271,8 @@ function runScripts(node) { // Dynamic tree entry points -var dynDepth = 0; - function dyn(s) { - var x = document.createElement("span"); + var x = parent(); x.dead = false; x.signal = s; x.sources = null; @@ -298,7 +301,6 @@ function dyn(s) { x.closures = cls.v; runScripts(x); }; - addNode(x); populate(x); } -- cgit v1.2.3