Created
November 30, 2011 18:20
-
-
Save zackd/1410126 to your computer and use it in GitHub Desktop.
// YUI trim - for browsers with no native String.trim() e.g. IE < 9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// YUI trim - for browsers with no native String.trim() e.g. IE < 9 | |
if (!String.prototype.trim) { | |
String.prototype.trim = function () { | |
try { | |
return this.replace(/^\s+|\s+$/g, ""); | |
} catch(e) { | |
return this; | |
} | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment