diff options
author | Steven Barth <steven@midlink.org> | 2008-09-16 15:51:11 +0000 |
---|---|---|
committer | Steven Barth <steven@midlink.org> | 2008-09-16 15:51:11 +0000 |
commit | 38e60dcf9bbd7208ae15282c333d2f1f7ea4d0a3 (patch) | |
tree | 52d5442a14eeed72ba78e142a90c7502e66e392e /libs/cbi/htdocs/luci-static/resources | |
parent | 7f0ff5c6554d9165645af67a6b8a252de67ffa5c (diff) |
More IE compatibility fixes
Diffstat (limited to 'libs/cbi/htdocs/luci-static/resources')
-rw-r--r-- | libs/cbi/htdocs/luci-static/resources/cbi.js | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/libs/cbi/htdocs/luci-static/resources/cbi.js b/libs/cbi/htdocs/luci-static/resources/cbi.js index 227e33269..f70818e16 100644 --- a/libs/cbi/htdocs/luci-static/resources/cbi.js +++ b/libs/cbi/htdocs/luci-static/resources/cbi.js @@ -1,6 +1,6 @@ var cbi_d = []; -function cbi_d_add(field, dep) { +function cbi_d_add(field, dep, next) { var obj = document.getElementById(field); if (obj) { var entry @@ -12,10 +12,10 @@ function cbi_d_add(field, dep) { } if (!entry) { entry = { - "id": field, "node": obj, - "parent": obj.parentNode, - "next": obj.nextSibling, + "id": field, + "parent": obj.parentNode.id, + "next": next, "deps": [] }; cbi_d.unshift(entry); @@ -57,16 +57,20 @@ function cbi_d_update() { var state = false; for (var i=0; i<cbi_d.length; i++) { var entry = cbi_d[i]; - if (entry.node.parentNode && !cbi_d_check(entry.deps)) { - entry.parent.removeChild(entry.node); - state = (state || !entry.node.parentNode) - } else if (!entry.node.parentNode && cbi_d_check(entry.deps)) { - if (!entry.next) { - entry.parent.appendChild(entry.node); + var next = document.getElementById(entry.next) + var node = document.getElementById(entry.id) + var parent = document.getElementById(entry.parent) + + if (node && node.parentNode && !cbi_d_check(entry.deps)) { + node.parentNode.removeChild(node); + state = (state || !node.parentNode) + } else if ((!node || !node.parentNode) && cbi_d_check(entry.deps)) { + if (!next) { + parent.appendChild(entry.node); } else { - entry.parent.insertBefore(entry.node, entry.next); + next.parentNode.insertBefore(entry.node, next); } - state = (state || entry.node.parentNode) + state = (state || (node && node.parentNode)) } } if (state) { |