diff options
Diffstat (limited to 'lib/js/urweb.js')
-rw-r--r-- | lib/js/urweb.js | 12 |
1 files changed, 7 insertions, 5 deletions
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); } |