Skip to content

Instantly share code, notes, and snippets.

@commuterjoy
Created September 28, 2011 09:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save commuterjoy/1247421 to your computer and use it in GitHub Desktop.
Save commuterjoy/1247421 to your computer and use it in GitHub Desktop.
polyfill the String.trim function for old Safari's etc.
if ("undefined" === typeof String.trim) {
String.prototype.trim = function() {
return this.replace(/^\s+|\s+$/g,"");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment