Created
January 20, 2011 21:42
-
-
Save shinypb/788739 to your computer and use it in GitHub Desktop.
Monkey-patch for jQuery to make it use native string trimming where available
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
// As of 1.4.2, jQuery doesn't make use of native string trimming when it's available | |
$.trim = (function (jQueryTrim) { | |
return ("test".trim && " test ".trim() === "test") ? function(str) { return str.trim(); } : jQueryTrim; | |
})($.trim); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment