luci-base: cbi.js: find dropdown and browser instances early
Gather dropdown and file browser widget nodes early, before initializing dynamic list widgets as dynlists invoke a dependency update which in turn might remove widget nodes from dom before they have been initialized. Ref: https://github.com/openwrt/luci/issues/2997#issuecomment-524251601 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
parent
c981cfd02a
commit
010102c2c2
1 changed files with 5 additions and 3 deletions
|
@ -736,7 +736,9 @@ function cbi_d_update() {
|
|||
}
|
||||
|
||||
function cbi_init() {
|
||||
var nodes;
|
||||
var dropdowns = document.querySelectorAll('.cbi-dropdown'),
|
||||
browsers = document.querySelectorAll('[data-browser]'),
|
||||
nodes;
|
||||
|
||||
nodes = document.querySelectorAll('[data-strings]');
|
||||
|
||||
|
@ -808,8 +810,8 @@ function cbi_init() {
|
|||
node.getAttribute('data-type'));
|
||||
}
|
||||
|
||||
document.querySelectorAll('.cbi-dropdown').forEach(cbi_dropdown_init);
|
||||
document.querySelectorAll('[data-browser]').forEach(cbi_browser_init);
|
||||
dropdowns.forEach(cbi_dropdown_init);
|
||||
browsers.querySelectorAll('[data-browser]').forEach(cbi_browser_init);
|
||||
|
||||
document.querySelectorAll('.cbi-tooltip:not(:empty)').forEach(function(s) {
|
||||
s.parentNode.classList.add('cbi-tooltip-container');
|
||||
|
|
Loading…
Reference in a new issue