Added a fix for when trim receives a null value (bug #1395).
authorJohn Resig <jeresig@gmail.com>
Fri, 20 Jul 2007 19:44:15 +0000 (19:44 +0000)
committerJohn Resig <jeresig@gmail.com>
Fri, 20 Jul 2007 19:44:15 +0000 (19:44 +0000)
src/jquery/jquery.js

index 8e370f8..2f3bc02 100644 (file)
@@ -1607,7 +1607,7 @@ jQuery.extend({
         * @cat JavaScript
         */
        trim: function(t){
-               return t.replace(/^\s+|\s+$/g, "");
+               return (t||"").replace(/^\s+|\s+$/g, "");
        },
 
        makeArray: function( a ) {