From 646d6199a644a1e6d65706c400163d00fa310bfe Mon Sep 17 00:00:00 2001 From: Byron Jones Date: Tue, 2 Jun 2015 13:25:33 +0800 Subject: Bug 1146771: implement comment tagging --- js/global.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'js/global.js') diff --git a/js/global.js b/js/global.js index 7675fd98a..7ecd3d901 100644 --- a/js/global.js +++ b/js/global.js @@ -87,3 +87,26 @@ function display_value(field, value) { if (translated) return translated; return value; } + +// polyfill .trim +if (!String.prototype.trim) { + (function() { + // Make sure we trim BOM and NBSP + var rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g; + String.prototype.trim = function() { + return this.replace(rtrim, ''); + }; + })(); +} + +// html encoding +if (!String.prototype.htmlEncode) { + (function() { + String.prototype.htmlEncode = function() { + return this.replace(/&/g, '&') + .replace(//g, '>') + .replace(/"/g, '"'); + }; + })(); +} -- cgit v1.2.3-24-g4f1b