mirror of https://git.openwrt.org/project/luci.git
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 " " 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>
This commit is contained in:
parent
dfb86709c6
commit
470bb2b854
|
@ -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
|
* @param {string} s
|
||||||
* The input string to clean.
|
* The input string to clean.
|
||||||
*
|
*
|
||||||
* @returns {string}
|
* @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) {
|
stripTags: function(s) {
|
||||||
if (typeof(s) == 'string' && !s.match(/[<>]/))
|
if (typeof(s) == 'string' && !s.match(/[<>\&]/))
|
||||||
return s;
|
return s;
|
||||||
|
|
||||||
var x = dom.elem(s) ? s : dom.parse('<div>' + s + '</div>');
|
var x = dom.elem(s) ? s : dom.parse('<div>' + s + '</div>');
|
||||||
|
|
Loading…
Reference in New Issue