comparison 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
comparison
equal deleted inserted replaced
897:2faf558b2d05 898:d1d0b18afd3d
221 pos = pos.lastChild; 221 pos = pos.lastChild;
222 222
223 return pos.parentNode; 223 return pos.parentNode;
224 } 224 }
225 225
226 function parent() {
227 return thisScript ? thisScript.parentNode : lastParent();
228 }
229
226 function addNode(node) { 230 function addNode(node) {
227 if (thisScript) { 231 if (thisScript) {
228 thisScript.parentNode.appendChild(node); 232 thisScript.parentNode.appendChild(node);
229 thisScript.parentNode.removeChild(thisScript); 233 thisScript.parentNode.removeChild(thisScript);
230 } else 234 } else {
231 lastParent().appendChild(node); 235 lastParent().appendChild(node);
236 }
232 } 237 }
233 238
234 function setHTML(html) { 239 function setHTML(html) {
235 var x = document.createElement("span"); 240 var x = document.createElement("span");
236 x.dead = false; 241 x.dead = false;
264 } 269 }
265 270
266 271
267 // Dynamic tree entry points 272 // Dynamic tree entry points
268 273
269 var dynDepth = 0;
270
271 function dyn(s) { 274 function dyn(s) {
272 var x = document.createElement("span"); 275 var x = parent();
273 x.dead = false; 276 x.dead = false;
274 x.signal = s; 277 x.signal = s;
275 x.sources = null; 278 x.sources = null;
276 x.closures = null; 279 x.closures = null;
277 x.recreate = function(v) { 280 x.recreate = function(v) {
296 var cls = {v : null}; 299 var cls = {v : null};
297 x.innerHTML = flatten(cls, v); 300 x.innerHTML = flatten(cls, v);
298 x.closures = cls.v; 301 x.closures = cls.v;
299 runScripts(x); 302 runScripts(x);
300 }; 303 };
301 addNode(x);
302 populate(x); 304 populate(x);
303 } 305 }
304 306
305 function input(t, s, recreate) { 307 function input(t, s, recreate) {
306 var x = document.createElement(t); 308 var x = document.createElement(t);