X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/f9d714dfd36fa56ced4c0a99a6e59c945ff89cca..a3d69ee264f234ee85990b20e421b7cee8baa669:/app/assets/javascripts/application.js?ds=inline diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index cbea58cc1..fc7cdb51c 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -113,6 +113,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