aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFilipe Fortes <filipe@fortes.com>2010-01-05 05:25:14 +0800
committerJohn Resig <jeresig@gmail.com>2010-01-07 00:11:22 +0800
commit0d1a2c1b1145ad17bec061a231b8426b3424d144 (patch)
treea0f0907f06a3d641b381aa5f5e5532c943a9c6ef /src
parent6861b5d4eb16222ed5ea623af6ce75362b55d1d4 (diff)
downloadjquery-0d1a2c1b1145ad17bec061a231b8426b3424d144.tar.gz
jquery-0d1a2c1b1145ad17bec061a231b8426b3424d144.zip
Make sure to do a deep copy on arrays. #5750
Diffstat (limited to 'src')
-rw-r--r--src/core.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/core.js b/src/core.js
index 975d23c0d..58cbbc7e5 100644
--- a/src/core.js
+++ b/src/core.js
@@ -316,10 +316,10 @@ jQuery.extend = jQuery.fn.extend = function() {
continue;
}
- // Recurse if we're merging object literal values
- if ( deep && copy && jQuery.isPlainObject(copy) ) {
- // Don't extend not object literals
- var clone = src && jQuery.isPlainObject(src) ? src : {};
+ // Recurse if we're merging object literal values or arrays
+ if ( deep && copy && ( jQuery.isPlainObject(copy) || jQuery.isArray(copy) ) ) {
+ var clone = src && ( jQuery.isPlainObject(src) || jQuery.isArray(src) ) ? src
+ : jQuery.isArray(copy) ? [] : {};
// Never move original objects, clone them
target[ name ] = jQuery.extend( deep, clone, copy );