File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -142,9 +142,14 @@ $.widget.extend = function( target ) {
142
142
for ( ; inputIndex < inputLength ; inputIndex ++ ) {
143
143
for ( key in input [ inputIndex ] ) {
144
144
value = input [ inputIndex ] [ key ] ;
145
- if ( input [ inputIndex ] . hasOwnProperty ( key ) && value !== undefined ) {
146
- if ( $ . isPlainObject ( value ) && $ . isPlainObject ( target [ key ] ) ) {
147
- target [ key ] = $ . widget . extend ( { } , target [ key ] , value ) ;
145
+ if ( input [ inputIndex ] . hasOwnProperty ( key ) && value !== undefined ) {
146
+ // Clone objects
147
+ if ( $ . isPlainObject ( value ) ) {
148
+ target [ key ] = $ . isPlainObject ( target [ key ] ) ?
149
+ $ . widget . extend ( { } , target [ key ] , value ) :
150
+ // Don't extend strings, arrays, etc. with objects
151
+ $ . widget . extend ( { } , value ) ;
152
+ // Copy everything else by reference
148
153
} else {
149
154
target [ key ] = value ;
150
155
}
You can’t perform that action at this time.
0 commit comments