summaryrefslogtreecommitdiff
path: root/js/App.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/App.js')
-rw-r--r--js/App.js24
1 files changed, 14 insertions, 10 deletions
diff --git a/js/App.js b/js/App.js
index 764003ca9..a3618409a 100644
--- a/js/App.js
+++ b/js/App.js
@@ -343,16 +343,20 @@ const App = {
});
},
// htmlspecialchars()-alike for headlines data-content attribute
- escapeHtml: function(text) {
- const map = {
- '&': '&',
- '<': '&lt;',
- '>': '&gt;',
- '"': '&quot;',
- "'": '&#039;'
- };
-
- return text.replace(/[&<>"']/g, function(m) { return map[m]; });
+ escapeHtml: function(p) {
+ if (typeof p == "string") {
+ const map = {
+ '&': '&amp;',
+ '<': '&lt;',
+ '>': '&gt;',
+ '"': '&quot;',
+ "'": '&#039;'
+ };
+
+ return p.replace(/[&<>"']/g, function(m) { return map[m]; });
+ } else {
+ return p;
+ }
},
displayIfChecked: function(checkbox, elemId) {
if (checkbox.checked) {