summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2022-05-16 16:12:01 +0200
committerJo-Philipp Wich <jo@mein.io>2022-05-16 16:12:01 +0200
commitb6ae1d4f4aec94b38e59b11e5fd9c28799dae05b (patch)
treed6e494c3758c18419e7a2988afe9ab4143e37700
parent4e090e38d2cb606936768847ab0f5526f95be793 (diff)
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 <jo@mein.io>
-rw-r--r--modules/luci-base/htdocs/luci-static/resources/form.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/modules/luci-base/htdocs/luci-static/resources/form.js b/modules/luci-base/htdocs/luci-static/resources/form.js
index 58f5a07fd6..0802d8b24d 100644
--- a/modules/luci-base/htdocs/luci-static/resources/form.js
+++ b/modules/luci-base/htdocs/luci-static/resources/form.js
@@ -3754,7 +3754,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');