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>
}
function cbi_init() {
- var nodes;
+ var dropdowns = document.querySelectorAll('.cbi-dropdown'),
+ browsers = document.querySelectorAll('[data-browser]'),
+ nodes;
nodes = document.querySelectorAll('[data-strings]');
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');