diff lib/js/urweb.js @ 898:d1d0b18afd3d

Working on Grid; have gone from one dynamic table bizareness to another
author Adam Chlipala <adamc@hcoop.net>
date Sun, 19 Jul 2009 17:45:02 -0400
parents ae9e22822ec5
children 25a038a9194b
line wrap: on
line diff
--- a/lib/js/urweb.js	Sat Jul 18 15:08:21 2009 -0400
+++ b/lib/js/urweb.js	Sun Jul 19 17:45:02 2009 -0400
@@ -223,12 +223,17 @@
   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 @@
 
 // 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 @@
     x.closures = cls.v;
     runScripts(x);
   };
-  addNode(x);
   populate(x);
 }