diff options
author | Ariel Flesler <aflesler@gmail.com> | 2008-05-14 19:45:31 +0000 |
---|---|---|
committer | Ariel Flesler <aflesler@gmail.com> | 2008-05-14 19:45:31 +0000 |
commit | 69f72761faa6878e361711b70f1d27c467d256e4 (patch) | |
tree | c8f4c0849af5a7f0145e75472e43751ef47c5bc1 | |
parent | 831625c43e85a010064cac18b14ea49f1531c315 (diff) | |
download | jquery-69f72761faa6878e361711b70f1d27c467d256e4.tar.gz jquery-69f72761faa6878e361711b70f1d27c467d256e4.zip |
jquery core: fixed deep extend of objects. Closes #1562 & #2820.
-rw-r--r-- | src/core.js | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/core.js b/src/core.js index 8743f05c4..98a0dc4bd 100644 --- a/src/core.js +++ b/src/core.js @@ -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 ) |