* @cat Ajax
*/
ajaxSetup: function( settings ) {
- jQuery.extend( jQuery.ajaxSettings, settings );
+ jQuery.extend( true, jQuery.ajaxSettings, settings );
},
ajaxSettings: {
ajax: function( s ) {
// Extend the settings, but re-extend 's' so that it can be
// checked again later (in the test suite, specifically)
- s = jQuery.extend(s, jQuery.extend({}, jQuery.ajaxSettings, s));
+ s = jQuery.extend(true, s, jQuery.extend(true, {}, jQuery.ajaxSettings, s));
// if data available
if ( s.data ) {
isObj( settings, merged, "Check if extended: settings must be extended" );
isObj( options, optionsCopy, "Check if not modified: options must not be modified" );
- jQuery.extend(deep1, deep2);
+ jQuery.extend(true, deep1, deep2);
isObj( deep1.foo, deepmerged.foo, "Check if foo: settings must be extended" );
isObj( deep2.foo, deep2copy.foo, "Check if not deep2: options must not be modified" );
*/
jQuery.extend = jQuery.fn.extend = function() {
// copy reference to target object
- var target = arguments[0] || {}, a = 1, al = arguments.length;
+ var target = arguments[0] || {}, a = 1, al = arguments.length, deep = false;
+
+ // Handle a deep copy situation
+ if ( target.constructor == Boolean ) {
+ deep = true;
+ target = arguments[1] || {};
+ }
// extend jQuery itself if only one argument is passed
if ( al == 1 ) {
continue;
// Recurse if we're merging object values
- if ( typeof prop[i] == 'object' && target[i] )
+ if ( deep && typeof prop[i] == 'object' && target[i] )
jQuery.extend( target[i], prop[i] );
// Don't bring in undefined values