From 2749957d6dd017a8ddf6a43454a4cf36e1f347eb Mon Sep 17 00:00:00 2001 From: JC Brand Date: Fri, 25 Sep 2015 21:03:37 +0000 Subject: [PATCH] Add polyfill for .trim --- src/polyfill.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/polyfill.js b/src/polyfill.js index d5e6ecb23..978236e03 100644 --- a/src/polyfill.js +++ b/src/polyfill.js @@ -14,3 +14,9 @@ String.prototype.splitOnce = function (delimiter) { var components = this.split(delimiter); return [components.shift(), components.join(delimiter)]; }; + +if (!String.prototype.trim) { + String.prototype.trim = function () { + return this.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ''); + }; +}