luci-base: fix createChoiceElement regex to catch closing tags with ! master openwrt-24.10
authorPaul Donald <newtwen+github@gmail.com>
Sat, 11 Jan 2025 01:47:30 +0000 (02:47 +0100)
committerPaul Donald <newtwen+github@gmail.com>
Sat, 11 Jan 2025 01:47:30 +0000 (02:47 +0100)
Signed-off-by: Paul Donald <newtwen+github@gmail.com>
modules/luci-base/htdocs/luci-static/resources/ui.js

index f077b41253f1f1caa65fbedf780ccbc6df5767b5..bff9acc3c002cf878978ac34c7c8f9d2a037eb04 100644 (file)
@@ -1598,7 +1598,7 @@ const UIDropdown = UIElement.extend(/** @lends LuCI.ui.Dropdown.prototype */ {
                let markup = null;
 
                if (tpl)
-                       markup = (tpl.textContent ?? tpl.innerHTML ?? tpl.firstChild.data).replace(/^<!--|-->$/, '').trim();
+                       markup = (tpl.textContent ?? tpl.innerHTML ?? tpl.firstChild.data).replace(/^<!--|--!?>$/g, '').trim();
                else
                        markup = '<li data-value="{{value}}"><span data-label-placeholder="true" /></li>';