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 ) {
142142 for ( ; inputIndex < inputLength ; inputIndex ++ ) {
143143 for ( key in input [ inputIndex ] ) {
144144 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
148153 } else {
149154 target [ key ] = value ;
150155 }
You can’t perform that action at this time.
0 commit comments