X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjquery%2Fjquery.js;h=b7091e26fa97c1b2924966cf3cc73748175ed50f;hb=2ef4093cf7f52383dd43bd361864edcda27e5c3c;hp=07588baac23ab8e115a71747cd3fb7e35b79f866;hpb=560484fd8d17ce6cf0b0d5748ad55d3dcb19d44f;p=jquery.git diff --git a/src/jquery/jquery.js b/src/jquery/jquery.js index 07588ba..b7091e2 100644 --- a/src/jquery/jquery.js +++ b/src/jquery/jquery.js @@ -1252,17 +1252,33 @@ jQuery.fn = jQuery.prototype = { */ jQuery.extend = jQuery.fn.extend = function() { // copy reference to target object - var target = arguments[0], a = 1; + var target = arguments[0] || {}, a = 1, al = arguments.length; // extend jQuery itself if only one argument is passed - if ( arguments.length == 1 ) { + if ( al == 1 ) { target = this; a = 0; } + var prop; - while ( (prop = arguments[a++]) != null ) - // Extend the base object - for ( var i in prop ) target[i] = prop[i]; + + for ( ; a < al; a++ ) + // Only deal with non-null/undefined values + if ( (prop = arguments[a]) != null ) + // Extend the base object + for ( var i in prop ) { + // Prevent never-ending loop + if ( target == prop[i] ) + continue; + + // Recurse if we're merging object values + if ( typeof prop[i] == 'object' && target[i] ) + jQuery.extend( target[i], prop[i] ); + + // Don't bring in undefined values + else if ( prop[i] != undefined ) + target[i] = prop[i]; + } // Return the modified object return target; @@ -1509,7 +1525,7 @@ jQuery.extend({ // then some display: none elements are involved else { // Locate all of the parent display: none elements - for ( var a = elem; color(a); a = a.parentNode ) + for ( var a = elem; a && color(a); a = a.parentNode ) stack.unshift(a); // Go through and make them visible, but in reverse @@ -1566,7 +1582,7 @@ jQuery.extend({ !s.indexOf("", ""] || - (!s.indexOf("", ""] || !s.indexOf("", ""] || !s.indexOf("", ""] || + [2, "", "
"] || + + // IE can't serialize and