Skip to content

Commit

Permalink
added string#trim-polyfill (again)
Browse files Browse the repository at this point in the history
  • Loading branch information
fb55 committed Oct 15, 2011
1 parent 3210841 commit 637666f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions readabilitySAX/readabilitySAX.xml
Expand Up @@ -26,6 +26,16 @@
return new F();
};
}
//polyfill for string#trim
if (!String.prototype.trim) {
//http://blog.stevenlevithan.com/archives/faster-trim-javascript
var trimBeginRegexp = /^\s\s*/;
var trimEndRegexp = /\s\s*$/;
String.prototype.trim = function () {
return String(this).replace(trimBeginRegexp, '').replace(trimEndRegexp, '');
};
}
//polyfill for function#bind
if (!Function.prototype.bind) {
Function.prototype.bind = function (oThis) {
if (typeof this !== "function") {
Expand Down

0 comments on commit 637666f

Please sign in to comment.