$.isObject({}) returns false!

I see that $.isObject is used in $.extends, to test whether an empty
object should be created:

        if ( src ) {
                clone = src;
        } else if ( jQuery.isArray(copy) ) {
                clone = [];
        } else if ( jQuery.isObject(copy) ) {
                clone = {};
        } else {
                clone = copy;
        }

So, in this situation we are not interested in other native objects
(ie. Date, RegExp, etc.) which will be treated as immutable values, so
why not just use:

isObject: function( obj ) {
        return toString.call(obj) === "[object Object]";
}

-- Mark

2009/7/23 John Resig <jere...@gmail.com>:
> I'll rope Yehuda in to see if he can explain it.
>
> --John
>
>
> On Thu, Jul 23, 2009 at 4:18 AM, Balazs Endresz <balazs.endr...@gmail.com>
> wrote:
>>
>> It has been marked as invalid and suggested to bring it up here:
>> http://dev.jquery.com/ticket/4946
>>
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to jquery-dev@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=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to