summaryrefslogtreecommitdiff
path: root/lib/js
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-08-06 14:24:40 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-08-06 14:24:40 -0400
commite5346fa5af27c6546bdbb3d9de6180b07aa0195e (patch)
tree8539a9b6f15a96a49a991341b0a0265d02f64e78 /lib/js
parent5f026ccb992d9737e1af05362849ff72faa2172c (diff)
dlist row add working with Konqueror
Diffstat (limited to 'lib/js')
-rw-r--r--lib/js/urweb.js51
1 files changed, 31 insertions, 20 deletions
diff --git a/lib/js/urweb.js b/lib/js/urweb.js
index 05d32e90..06ff19cf 100644
--- a/lib/js/urweb.js
+++ b/lib/js/urweb.js
@@ -252,7 +252,7 @@ function runScripts(node) {
doExn(v);
}
if (thisScript.parentNode)
- thisScripts.parentNode.removeChild(thisScript);
+ thisScript.parentNode.removeChild(thisScript);
}
thisScript = savedScript;
@@ -262,23 +262,22 @@ function runScripts(node) {
// Dynamic tree entry points
-function dyn(s) {
- var x = document.createElement("div");
- x.style.display = "inline";
+function dyn(pnode, s) {
+ var x = document.createElement("script");
x.dead = false;
x.signal = s;
x.sources = null;
x.closures = null;
- var first = null;
+ var child = null;
x.recreate = function(v) {
for (var ls = x.closures; ls; ls = ls.next)
freeClosure(ls.data);
- for (var node = first; node && node != x; ) {
- if (node.getElementsByTagName) {
- var arr = node.getElementsByTagName("div");
+ if (child) {
+ if (child.getElementsByTagName) {
+ var arr = child.getElementsByTagName("script");
for (var i = 0; i < arr.length; ++i) {
var span = arr[i];
span.dead = true;
@@ -289,24 +288,36 @@ function dyn(s) {
}
}
- var old = node;
- node = node.nextSibling;
- if (old.parentNode)
- old.parentNode.removeChild(old);
+ if (child.parentNode)
+ child.parentNode.removeChild(child);
}
var cls = {v : null};
- var dummy = document.createElement("table");
- dummy.innerHTML = flatten(cls, v);
+ var html = flatten(cls, v);
x.closures = cls.v;
- runScripts(dummy);
- for (first = dummy.firstChild; first && first.tagName == "TBODY"; first = first.firstChild);
- for (var node = first; node; ) {
- var old = node;
- node = node.nextSibling;
+ if (pnode == "table") {
+ var dummy = document.createElement("body");
+ dummy.innerHTML = "<table>" + html + "</table>";
+ runScripts(dummy);
+ var rows = dummy.firstChild.rows;
+ var nRows = rows.length;
+ var table = x.parentNode;
+
+ var arr = dummy.getElementsByTagName("tbody");
+ if (arr.length > 0) {
+ var tbody = arr[0], next;
+ for (var node = tbody.firstChild; node; node = next) {
+ next = node.nextSibling;
+ table.appendChild(node);
+ }
+ }
+ } else {
+ child = document.createElement("span");
+ child.innerHTML = html;
+ runScripts(child);
if (x.parentNode)
- x.parentNode.insertBefore(old, x);
+ x.parentNode.insertBefore(child, x);
}
};