Well, we don't want "isObject" (or isJavaScriptObject or
isNativeObject) since that'll allow things like 'new String'. We
explicitly want the case where people are using {} or new Object in
their code, adding on some properties, and passing it around. It sound
like you're worried about some sort of semantic difference between
isObjectLiteral and wasDefinedUsingAnObjectLiteral - but I don't think
that really matters.

--John



On Wed, Dec 2, 2009 at 7:36 PM, Michael Geary <m...@mg.to> wrote:
> "isObjectLiteral" is a really poor name for that function. It makes no sense
> at all. An object *literal* is text. It's not an object until it's parsed,
> and then it's not an object literal any more, it's just an Object.
>
> Case in point: jQuery.isObjectLiteral({}) and jQuery.isObjectLiteral(new
> Object) both return true. I don't think there is any way to distinguish
> between a '{}' and a 'new Object', is there?
>
> This function definitely needs to be renamed. What does it actually do? Is
> its purpose to distinguish between a JavaScript object and a DOM object?
> Then it could be called isJavaScriptObject or isNativeObject or some such.
> Not isObjectLiteral please.
>
> Sorry, this is one of my pet peeves - the Google Maps API documentation
> describes many of its option objects as "object literals", which is quite
> misleading and confusing. (Maps newbies sometimes think they *have* to use
> an object literal and can't use an object that they build on the fly.)
>
> -Mike
>
> On Wed, Dec 2, 2009 at 3:36 PM, John Resig <jere...@gmail.com> wrote:
>>
>> > Yep, like I said earlier
>> > jQuery.isObjectLiteral(document.createElement("div")) returns true in
>> > IE8
>> > (dunno for earlier versions) but John seems to be working on it. Can't
>> > believe how difficult to get right these type controlling codes can be.
>> > Seems like magic to me sometimes.
>>
>> I actually landed the fix for it earlier today. We should be all good now.
>>
>> --John
>>
>> --
>>
>> 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=en.
>>
>>
>
> --
>
> 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=en.
>

--

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=en.


Reply via email to