summaryrefslogtreecommitdiffstats
path: root/js/global.js
diff options
context:
space:
mode:
authorByron Jones <glob@mozilla.com>2015-06-02 07:25:33 +0200
committerByron Jones <glob@mozilla.com>2015-06-02 07:25:33 +0200
commit646d6199a644a1e6d65706c400163d00fa310bfe (patch)
tree4ae677220b8464dc99c29b5ee7609db15fc1befc /js/global.js
parent4c751704c9644faf357adeea13584b08a359593d (diff)
downloadbugzilla-646d6199a644a1e6d65706c400163d00fa310bfe.tar.gz
bugzilla-646d6199a644a1e6d65706c400163d00fa310bfe.tar.xz
Bug 1146771: implement comment tagging
Diffstat (limited to 'js/global.js')
-rw-r--r--js/global.js23
1 files changed, 23 insertions, 0 deletions
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, '&amp;')
+ .replace(/</g, '&lt;')
+ .replace(/>/g, '&gt;')
+ .replace(/"/g, '&quot;');
+ };
+ })();
+}