git.asbjorn.biz
/
jquery.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
831625c
)
jquery core: fixed deep extend of objects. Closes #1562 & #2820.
author
Ariel Flesler
<aflesler@gmail.com>
Wed, 14 May 2008 19:45:31 +0000
(19:45 +0000)
committer
Ariel Flesler
<aflesler@gmail.com>
Wed, 14 May 2008 19:45:31 +0000
(19:45 +0000)
src/core.js
patch
|
blob
|
history
diff --git
a/src/core.js
b/src/core.js
index
8743f05
..
98a0dc4
100644
(file)
--- 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
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 )
// Don't bring in undefined values
else if ( copy !== undefined )