I was using objects as custom data structures for class initialization (
meaning var myWidget = new Widget( { foo: 'bar' } ) ), and I needed to be
able to build up a master configuration that was the combination of all of
the different sources. The idea is that I would use configuration
Wat a hell is going here?
// Recurse if we're merging object values
if ( deep copy typeof copy === object !copy.nodeType ) {
var clone;
if ( src ) {
clone = src;
} else if ( jQuery.isArray(copy) ) {
clone = [];
} else if ( jQuery.isObject(copy) ) {
clone = {};
} else {
If someone wants to pass in a random object to be extended we won't
stop them. So yeah, someone could do:
jQuery.extend([1,2], [3]) and get [3,2] as a result - not sure why you
would want to, though. I can't think of a reason to explicitly prevent
this behavior, at least.
(On a related note I've