diff options
Diffstat (limited to 'src/core.js')
-rw-r--r-- | src/core.js | 8 |
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 ); |