diff options
Diffstat (limited to 'js/App.js')
-rw-r--r-- | js/App.js | 24 |
1 files changed, 14 insertions, 10 deletions
@@ -343,16 +343,20 @@ const App = { }); }, // htmlspecialchars()-alike for headlines data-content attribute - escapeHtml: function(text) { - const map = { - '&': '&', - '<': '<', - '>': '>', - '"': '"', - "'": ''' - }; - - return text.replace(/[&<>"']/g, function(m) { return map[m]; }); + escapeHtml: function(p) { + if (typeof p == "string") { + const map = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + "'": ''' + }; + + return p.replace(/[&<>"']/g, function(m) { return map[m]; }); + } else { + return p; + } }, displayIfChecked: function(checkbox, elemId) { if (checkbox.checked) { |