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 renamed isObject to isObjectLiteral.)

--John



On Tue, Nov 10, 2009 at 9:10 PM, Robert Katić <robert.ka...@gmail.com> wrote:
> 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 {
>    clone = copy;
>  }
>
>  // Never move original objects, clone them
>  target[ name ] = jQuery.extend( deep, clone, copy );
>
>
> You are going to extend with any object including a Date, a String, a
> Number... (ah yes, excluding nodes).
>
> You are going to extend (with) arrays? [1,2] and [4] to obtain [4,2].
> Really?
>
> If an object is not an array nor an object literal then extend object
> with itself???
>
> The only things to extend recursively are objects literals to me:
>
> if ( deep && copy && jQuery.isObject(copy) && (!src || jQuery.isObject
> (src)) ) {
>  target[ name ] = jQuery.extend( deep, src || {}, copy );
> }
>
> Am I loosing my mind? :)
>
> --
>
> You received this message because you are subscribed to the Google Groups 
> "jQuery Development" group.
> To post to this group, send email to jquery-...@googlegroups.com.
> To unsubscribe from this group, send email to 
> jquery-dev+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/jquery-dev?hl=.
>
>
>

--

You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to jquery-...@googlegroups.com.
To unsubscribe from this group, send email to 
jquery-dev+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=.


Reply via email to