summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-base/htdocs/luci-static/resources
diff options
context:
space:
mode:
authorMikael Magnusson <mikma@users.sourceforge.net>2024-08-20 22:17:36 +0200
committerPaul Donald <newtwen+github@gmail.com>2024-09-18 23:26:48 +0200
commit470bb2b8540e5b4949c66b04e5f583c5c36a5a7b (patch)
tree29fb6c5bddee2e64e0604ce93e4d417b2439d85a /modules/luci-base/htdocs/luci-static/resources
parentdfb86709c6469fe32cb9dbd0b5b0f184562186cf (diff)
luci-base: form.js: decode HTML entities in AbstractElement.stripTags()
This commit fixes a problem with HTML entities which were visible in their encoded form in the mobile view. This happened for example when displaying a GridSection with a Value option containing "&nbsp;" in the title. Without this change only HTML entities in titles that also contains tags are decoded before they are stored in data-title attributes. Signed-off-by: Mikael Magnusson <mikma@users.sourceforge.net>
Diffstat (limited to 'modules/luci-base/htdocs/luci-static/resources')
-rw-r--r--modules/luci-base/htdocs/luci-static/resources/form.js8
1 files changed, 5 insertions, 3 deletions
diff --git a/modules/luci-base/htdocs/luci-static/resources/form.js b/modules/luci-base/htdocs/luci-static/resources/form.js
index 3834bceb01..624bc2c2f8 100644
--- a/modules/luci-base/htdocs/luci-static/resources/form.js
+++ b/modules/luci-base/htdocs/luci-static/resources/form.js
@@ -275,16 +275,18 @@ var CBIAbstractElement = baseclass.extend(/** @lends LuCI.form.AbstractElement.p
},
/**
- * Strip any HTML tags from the given input string.
+ * Strip any HTML tags from the given input string, and decode
+ * HTML entities.
*
* @param {string} s
* The input string to clean.
*
* @returns {string}
- * The cleaned input string with HTML tags removed.
+ * The cleaned input string with HTML tags removed, and HTML
+ * entities decoded.
*/
stripTags: function(s) {
- if (typeof(s) == 'string' && !s.match(/[<>]/))
+ if (typeof(s) == 'string' && !s.match(/[<>\&]/))
return s;
var x = dom.elem(s) ? s : dom.parse('<div>' + s + '</div>');