From: Jo-Philipp Wich Date: Tue, 10 Sep 2019 15:37:42 +0000 (+0200) Subject: luci-base: cbi.js: fix dropdown and browser initialization X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=c0f3e3c6a297da4ec13955eef9dedb419fdc4894;p=oweals%2Fluci.git luci-base: cbi.js: fix dropdown and browser initialization We need to query the dropdowns before initializing dynamic lists but after initializing combo boxes. Also fix a copy-paste error from a previous commit. Fixes: 010102c2c ("luci-base: cbi.js: find dropdown and browser instances early") Signed-off-by: Jo-Philipp Wich --- diff --git a/modules/luci-base/htdocs/luci-static/resources/cbi.js b/modules/luci-base/htdocs/luci-static/resources/cbi.js index 0de7bcb9c..4055ea1a5 100644 --- a/modules/luci-base/htdocs/luci-static/resources/cbi.js +++ b/modules/luci-base/htdocs/luci-static/resources/cbi.js @@ -736,9 +736,7 @@ function cbi_d_update() { } function cbi_init() { - var dropdowns = document.querySelectorAll('.cbi-dropdown'), - browsers = document.querySelectorAll('[data-browser]'), - nodes; + var dropdowns, browsers, nodes; nodes = document.querySelectorAll('[data-strings]'); @@ -787,6 +785,9 @@ function cbi_init() { node.getAttribute('data-manual')); } + dropdowns = document.querySelectorAll('.cbi-dropdown'); + browsers = document.querySelectorAll('[data-browser]'); + nodes = document.querySelectorAll('[data-dynlist]'); for (var i = 0, node; (node = nodes[i]) !== undefined; i++) { @@ -811,7 +812,7 @@ function cbi_init() { } dropdowns.forEach(cbi_dropdown_init); - browsers.querySelectorAll('[data-browser]').forEach(cbi_browser_init); + browsers.forEach(cbi_browser_init); document.querySelectorAll('.cbi-tooltip:not(:empty)').forEach(function(s) { s.parentNode.classList.add('cbi-tooltip-container');