X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/d4135390acff291f2f2c15d9fb86723ebf4fe755..258e66299ac45c4dbb951dee0a92194301b31737:/app/assets/javascripts/application.js diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index b257f7fed..225ddaf44 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -122,6 +122,19 @@ function cookieContent(map) { return [center.lng, center.lat, map.getZoom(), map.getLayersCode()].join('|'); } +function escapeHTML(string) { + var htmlEscapes = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + "'": ''' + }; + return string == null ? '' : (string + '').replace(/[&<>"']/g, function(match) { + return htmlEscapes[match]; + }); +} + /* * Forms which have been cached by rails may have the wrong * authenticity token, so patch up any forms with the correct