From: Jo-Philipp Wich Date: Fri, 19 Feb 2021 09:39:00 +0000 (+0100) Subject: luci-base: ui.js: resolve parent ul early in UIDropdown.toggleItem() X-Git-Url: http://git.openwrt.org/?a=commitdiff_plain;h=b8d2bcd432ab23a883de1dd4fbce29f9751a6e84;p=project%2Fluci.git luci-base: ui.js: resolve parent ul early in UIDropdown.toggleItem() The parent node of the current li might be null after collapsing the dropdown, so resolve the parent ul early to avoid passing null to subsequent calls. Fixes clearing custom input values in DynamicList dropdowns. Signed-off-by: Jo-Philipp Wich --- diff --git a/modules/luci-base/htdocs/luci-static/resources/ui.js b/modules/luci-base/htdocs/luci-static/resources/ui.js index 3ada9e375a..c8ebef6691 100644 --- a/modules/luci-base/htdocs/luci-static/resources/ui.js +++ b/modules/luci-base/htdocs/luci-static/resources/ui.js @@ -1360,6 +1360,8 @@ var UIDropdown = UIElement.extend(/** @lends LuCI.ui.Dropdown.prototype */ { /** @private */ toggleItem: function(sb, li, force_state) { + var ul = li.parentNode; + if (li.hasAttribute('unselectable')) return; @@ -1436,7 +1438,7 @@ var UIDropdown = UIElement.extend(/** @lends LuCI.ui.Dropdown.prototype */ { this.closeDropdown(sb, true); } - this.saveValues(sb, li.parentNode); + this.saveValues(sb, ul); }, /** @private */