jquery core: fixed deep extend of objects. Closes #1562 & #2820.

This commit is contained in:
Ariel Flesler 2008-05-14 19:45:31 +00:00
parent 831625c43e
commit 69f72761fa

View file

@ -579,8 +579,11 @@ jQuery.extend = jQuery.fn.extend = function() {
continue;
// Recurse if we're merging object values
if ( deep && copy && typeof copy == "object" && src && !copy.nodeType )
target[ name ] = jQuery.extend( deep, src, copy );
if ( deep && copy && typeof copy == "object" && !copy.nodeType )
target[ name ] = jQuery.extend( deep,
// Never move original objects, clone them
src || ( copy.length != null ? [ ] : { } )
, copy );
// Don't bring in undefined values
else if ( copy !== undefined )