From c33df8f75c98aee66f7dfec58e4a8efbfb4651ec Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Fri, 19 Feb 2021 10:39:00 +0100 Subject: [PATCH] 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 (cherry picked from commit b8d2bcd432ab23a883de1dd4fbce29f9751a6e84) --- modules/luci-base/htdocs/luci-static/resources/ui.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/luci-base/htdocs/luci-static/resources/ui.js b/modules/luci-base/htdocs/luci-static/resources/ui.js index 5d6b2e43f7..95419c4991 100644 --- a/modules/luci-base/htdocs/luci-static/resources/ui.js +++ b/modules/luci-base/htdocs/luci-static/resources/ui.js @@ -1306,6 +1306,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; @@ -1382,7 +1384,7 @@ var UIDropdown = UIElement.extend(/** @lends LuCI.ui.Dropdown.prototype */ { this.closeDropdown(sb, true); } - this.saveValues(sb, li.parentNode); + this.saveValues(sb, ul); }, /** @private */