1 | jQuery.extend = jQuery.fn.extend = function() { |
---|
2 | ... |
---|
3 | for ( ; i < length; i++ ) |
---|
4 | // Only deal with non-null/undefined values |
---|
5 | if ( (options = arguments[ i ]) != null ) |
---|
6 | // Extend the base object |
---|
7 | for ( var name in options ) { |
---|
8 | var src = target[ name ], copy = options[ name ]; |
---|
9 | |
---|
10 | // Prevent never-ending loop |
---|
11 | if ( target === copy ) |
---|
12 | continue; |
---|
13 | |
---|
14 | // Recurse if we're merging object values |
---|
15 | if ( deep && copy && typeof copy === "object" && !copy.nodeType ) |
---|
16 | target[ name ] = jQuery.extend( deep, |
---|
17 | // Never move original objects, clone them |
---|
18 | (typeof src === "object" ? src : null) || ( copy.length != null ? [ ] : { } ) //***Changed*** |
---|
19 | , copy ); |
---|
20 | |
---|
21 | // Don't bring in undefined values |
---|
22 | else if ( copy !== undefined ) |
---|
23 | target[ name ] = copy; |
---|
24 | |
---|
25 | } |
---|
26 | |
---|
27 | // Return the modified object |
---|
28 | return target; |
---|
29 | }; |
---|