diff --git a/code/portal_detail_display.js b/code/portal_detail_display.js index 03e80fcb..c3ba306b 100644 --- a/code/portal_detail_display.js +++ b/code/portal_detail_display.js @@ -54,7 +54,7 @@ window.renderPortalDetails = function(guid) { $('#portaldetails') .attr('class', TEAM_TO_CSS[getTeam(d)]) .html('' - + '

'+d.portalV2.descriptiveText.TITLE+'

' + + '

'+escapeHtmlSpecialChars(d.portalV2.descriptiveText.TITLE)+'

' + 'X' // help cursor via ".imgpreview img" + '
' diff --git a/code/utils_misc.js b/code/utils_misc.js index db072e06..07ba33e8 100644 --- a/code/utils_misc.js +++ b/code/utils_misc.js @@ -365,6 +365,14 @@ window.escapeJavascriptString = function(str) { return (str+'').replace(/[\\"']/g,'\\$&'); } +//escape special characters, such as tags +window.escapeHtmlSpecialChars = function(str) { + var div = document.createElement(div); + var text = document.createTextNode(str); + div.appendChild(text); + return div.innerHTML; +} + window.prettyEnergy = function(nrg) { return nrg> 1000 ? Math.round(nrg/1000) + ' k': nrg; }