From e480d87b346f498eb9622e7da204779146a4c415 Mon Sep 17 00:00:00 2001 From: rolux Date: Fri, 25 May 2012 14:16:51 +0200 Subject: [PATCH] add String.prototype.trim --- source/Ox/js/Fallback.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/source/Ox/js/Fallback.js b/source/Ox/js/Fallback.js index 2ab2e492..07e08c9a 100644 --- a/source/Ox/js/Fallback.js +++ b/source/Ox/js/Fallback.js @@ -118,3 +118,10 @@ if (!Object.keys) { return ret; }; } + +// see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String/Trim +if (!String.prototype.trim) { + String.prototype.trim = function() { + return this.replace(/^\s+|\s+$/g, ''); + }; +}