@@ 324-386 (lines=63) @@ | ||
321 | // Give the init function the jQuery prototype for later instantiation |
|
322 | jQuery.fn.init.prototype = jQuery.fn; |
|
323 | ||
324 | jQuery.extend = jQuery.fn.extend = function() { |
|
325 | var options, name, src, copy, copyIsArray, clone, |
|
326 | target = arguments[0] || {}, |
|
327 | i = 1, |
|
328 | length = arguments.length, |
|
329 | deep = false; |
|
330 | ||
331 | // Handle a deep copy situation |
|
332 | if ( typeof target === "boolean" ) { |
|
333 | deep = target; |
|
334 | target = arguments[1] || {}; |
|
335 | // skip the boolean and the target |
|
336 | i = 2; |
|
337 | } |
|
338 | ||
339 | // Handle case when target is a string or something (possible in deep copy) |
|
340 | if ( typeof target !== "object" && !jQuery.isFunction(target) ) { |
|
341 | target = {}; |
|
342 | } |
|
343 | ||
344 | // extend jQuery itself if only one argument is passed |
|
345 | if ( length === i ) { |
|
346 | target = this; |
|
347 | --i; |
|
348 | } |
|
349 | ||
350 | for ( ; i < length; i++ ) { |
|
351 | // Only deal with non-null/undefined values |
|
352 | if ( (options = arguments[ i ]) != null ) { |
|
353 | // Extend the base object |
|
354 | for ( name in options ) { |
|
355 | src = target[ name ]; |
|
356 | copy = options[ name ]; |
|
357 | ||
358 | // Prevent never-ending loop |
|
359 | if ( target === copy ) { |
|
360 | continue; |
|
361 | } |
|
362 | ||
363 | // Recurse if we're merging plain objects or arrays |
|
364 | if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { |
|
365 | if ( copyIsArray ) { |
|
366 | copyIsArray = false; |
|
367 | clone = src && jQuery.isArray(src) ? src : []; |
|
368 | ||
369 | } else { |
|
370 | clone = src && jQuery.isPlainObject(src) ? src : {}; |
|
371 | } |
|
372 | ||
373 | // Never move original objects, clone them |
|
374 | target[ name ] = jQuery.extend( deep, clone, copy ); |
|
375 | ||
376 | // Don't bring in undefined values |
|
377 | } else if ( copy !== undefined ) { |
|
378 | target[ name ] = copy; |
|
379 | } |
|
380 | } |
|
381 | } |
|
382 | } |
|
383 | ||
384 | // Return the modified object |
|
385 | return target; |
|
386 | }; |
|
387 | ||
388 | jQuery.extend({ |
|
389 | noConflict: function( deep ) { |
@@ 315-377 (lines=63) @@ | ||
312 | // Give the init function the jQuery prototype for later instantiation |
|
313 | jQuery.fn.init.prototype = jQuery.fn; |
|
314 | ||
315 | jQuery.extend = jQuery.fn.extend = function() { |
|
316 | var options, name, src, copy, copyIsArray, clone, |
|
317 | target = arguments[0] || {}, |
|
318 | i = 1, |
|
319 | length = arguments.length, |
|
320 | deep = false; |
|
321 | ||
322 | // Handle a deep copy situation |
|
323 | if ( typeof target === "boolean" ) { |
|
324 | deep = target; |
|
325 | target = arguments[1] || {}; |
|
326 | // skip the boolean and the target |
|
327 | i = 2; |
|
328 | } |
|
329 | ||
330 | // Handle case when target is a string or something (possible in deep copy) |
|
331 | if ( typeof target !== "object" && !jQuery.isFunction(target) ) { |
|
332 | target = {}; |
|
333 | } |
|
334 | ||
335 | // extend jQuery itself if only one argument is passed |
|
336 | if ( length === i ) { |
|
337 | target = this; |
|
338 | --i; |
|
339 | } |
|
340 | ||
341 | for ( ; i < length; i++ ) { |
|
342 | // Only deal with non-null/undefined values |
|
343 | if ( (options = arguments[ i ]) != null ) { |
|
344 | // Extend the base object |
|
345 | for ( name in options ) { |
|
346 | src = target[ name ]; |
|
347 | copy = options[ name ]; |
|
348 | ||
349 | // Prevent never-ending loop |
|
350 | if ( target === copy ) { |
|
351 | continue; |
|
352 | } |
|
353 | ||
354 | // Recurse if we're merging plain objects or arrays |
|
355 | if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { |
|
356 | if ( copyIsArray ) { |
|
357 | copyIsArray = false; |
|
358 | clone = src && jQuery.isArray(src) ? src : []; |
|
359 | ||
360 | } else { |
|
361 | clone = src && jQuery.isPlainObject(src) ? src : {}; |
|
362 | } |
|
363 | ||
364 | // Never move original objects, clone them |
|
365 | target[ name ] = jQuery.extend( deep, clone, copy ); |
|
366 | ||
367 | // Don't bring in undefined values |
|
368 | } else if ( copy !== undefined ) { |
|
369 | target[ name ] = copy; |
|
370 | } |
|
371 | } |
|
372 | } |
|
373 | } |
|
374 | ||
375 | // Return the modified object |
|
376 | return target; |
|
377 | }; |
|
378 | ||
379 | jQuery.extend({ |
|
380 | noConflict: function( deep ) { |