From e06751f5a32ca54d874cc08367743adeba9a15ad Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Mon, 16 May 2022 16:12:01 +0200 Subject: [PATCH] luci-base: form.js: trim option description If a whitespace-only description is set on an element, the CSS :empty selector will not match, causing description icons to be shown when there's no actual content. To avoid that, trim the description string when building the element. Signed-off-by: Jo-Philipp Wich (cherry picked from commit b6ae1d4f4aec94b38e59b11e5fd9c28799dae05b) --- modules/luci-base/htdocs/luci-static/resources/form.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/luci-base/htdocs/luci-static/resources/form.js b/modules/luci-base/htdocs/luci-static/resources/form.js index 7970bc1876..9aca058098 100644 --- a/modules/luci-base/htdocs/luci-static/resources/form.js +++ b/modules/luci-base/htdocs/luci-static/resources/form.js @@ -3709,7 +3709,7 @@ var CBIValue = CBIAbstractValue.extend(/** @lends LuCI.form.Value.prototype */ { if (!in_table && typeof(this.description) === 'string' && this.description !== '') dom.append(optionEl.lastChild || optionEl, - E('div', { 'class': 'cbi-value-description' }, this.description)); + E('div', { 'class': 'cbi-value-description' }, this.description.trim())); if (depend_list && depend_list.length) optionEl.classList.add('hidden'); -- 2.30.2