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:43:28 +0000 (08:43 +0100)
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
modules/luci-base/htdocs/luci-static/resources/cbi.js

index 2dba54750d230300b600f1c7f5be2ebdec4328c7..92c41515fb3d166a75600b9043ef4f325c1301c9 100644 (file)
@@ -731,6 +731,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);
 }