summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2016-02-10 19:29:29 +0100
committerJo-Philipp Wich <jow@openwrt.org>2016-02-10 19:29:34 +0100
commit9ce798abd4da80a5769f493a3aea729781cfae97 (patch)
tree75fac0b852a2fb821d90c03fbb83310ac3494075
parent58e2f557da49e5acb1d4395a9698b1953f1586c3 (diff)
luci-base: cbi: properly handle dependant elements without parent
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
-rw-r--r--modules/luci-base/htdocs/luci-static/resources/cbi.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/modules/luci-base/htdocs/luci-static/resources/cbi.js b/modules/luci-base/htdocs/luci-static/resources/cbi.js
index a1491cc66..f58306954 100644
--- a/modules/luci-base/htdocs/luci-static/resources/cbi.js
+++ b/modules/luci-base/htdocs/luci-static/resources/cbi.js
@@ -454,7 +454,7 @@ function cbi_d_update() {
if (node && node.parentNode && !cbi_d_check(entry.deps)) {
node.parentNode.removeChild(node);
state = true;
- } else if ((!node || !node.parentNode) && cbi_d_check(entry.deps)) {
+ } else if (parent && (!node || !node.parentNode) && cbi_d_check(entry.deps)) {
var next = undefined;
for (next = parent.firstChild; next; next = next.nextSibling) {
@@ -473,7 +473,7 @@ function cbi_d_update() {
}
// hide optionals widget if no choices remaining
- if (parent.parentNode && parent.getAttribute('data-optionals'))
+ if (parent && parent.parentNode && parent.getAttribute('data-optionals'))
parent.parentNode.style.display = (parent.options.length <= 1) ? 'none' : '';
}