luci-base: cbi.js: avoid double-initialization of dropdowns
authorJo-Philipp Wich <jo@mein.io>
Fri, 14 Feb 2020 07:43:28 +0000 (08:43 +0100)
committerJo-Philipp Wich <jo@mein.io>
Fri, 14 Feb 2020 07:46:38 +0000 (08:46 +0100)
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 9ae1f478960f9587e8123e61e1a2221e866da26b)

modules/luci-base/htdocs/luci-static/resources/cbi.js

index ff198027e37df4dd7f72f7dec6fe881e62bf3752..f9b601995c541f940ef43bf0b5a383a64280190a 100644 (file)
@@ -714,6 +714,9 @@ if (typeof(window.CustomEvent) !== 'function') {
 }
 
 function cbi_dropdown_init(sb) {
+       if (sb && L.dom.findClassInstance(sb) instanceof L.ui.Dropdown)
+               return;
+
        var dl = new L.ui.Dropdown(sb, null, { name: sb.getAttribute('name') });
        return dl.bind(sb);
 }