luci-base: ui.js: fix rendering of rich dropdown placeholders
authorJo-Philipp Wich <jo@mein.io>
Thu, 6 Jun 2019 18:49:19 +0000 (20:49 +0200)
committerJo-Philipp Wich <jo@mein.io>
Sun, 7 Jul 2019 13:36:25 +0000 (15:36 +0200)
Placeholders may be HTML elements instead of plain strings, so do
not use innerHTML to assign them but rely on L.dom.content() instead.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
modules/luci-base/htdocs/luci-static/resources/ui.js

index 3370d225cd751e76d5edd136dfd65da8d4acb897..c51d651e9e7b8e0b6af57dd8a6449b2dde36d5ed 100644 (file)
@@ -477,8 +477,8 @@ var UIDropdown = UIElement.extend({
                else
                        sb.removeAttribute('empty');
 
-               more.innerHTML = (ndisplay == this.options.display_items)
-                       ? (this.options.select_placeholder || this.options.placeholder) : '···';
+               L.dom.content(more, (ndisplay == this.options.display_items)
+                       ? (this.options.select_placeholder || this.options.placeholder) : '···');
 
 
                sb.addEventListener('click', this.handleClick.bind(this));
@@ -715,8 +715,8 @@ var UIDropdown = UIElement.extend({
                        else
                                sb.removeAttribute('empty');
 
-                       more.innerHTML = (ndisplay === this.options.display_items)
-                               ? (this.options.select_placeholder || this.options.placeholder) : '···';
+                       L.dom.content(more, (ndisplay === this.options.display_items)
+                               ? (this.options.select_placeholder || this.options.placeholder) : '···');
                }
                else {
                        var sel = li.parentNode.querySelector('[selected]');