Re: typeof document.all

Siterer Brendan Eich <brendan@mozilla.org>:

>>> How is that not what you called a "weird result"? It's similar to   
>>> what we do in assigning undefined, i.e., treating assignment as   
>>> "detecting".
>>
>> Having the object evaluate to false does not seem so weird to me.

Just chiming in to confirm what Anne said (for proof and reference I  
attach a somewhat enhanced demo file we used to compare our doc.all  
cloaking and support to other implementations).

I didn't quite understand the comment about "treating assignment as  
'detecting'" because we do no such thing.

> Let me get this straight: the only cases where Opera evaluates
> document.all to false are cases in ECMA-262 that apply the ToBoolean
> internal helper. Otherwise it evaluates to a collection.

While I haven't looked up ToBoolean in 262 now to confirm, this sounds  
exactly right.

We seem to have gotten away without more magic, compatibility-wise. I  
looked through your Google code searches. Two things look like they  
are broken - you already pointed out one:

http://www.google.com/codesearch/p?hl=en&sa=N&cd=2&ct=rc#q9MmssN9DGw/root/projects/openquote/1.1/core/domain/jboss/deploy/alfresco.war/scripts/ajax/tagger.js&q=lang:javascript%20%22.all%20%3D%3D%20undefined%22&l=396
http://www.google.com/codesearch/p?hl=en&sa=N&cd=2&ct=rc#m6yMHImV59o/XoopsModules/content/trunk/js/content.js&q=lang:javascript%20%22.all%20!%3D%20undefined%22

but the rest generally should work, either because the script uses IE  
APIs we already choose to support (i.e. attachEvent()) or because  
document.all usage is part of a larger browser sniffing approach that  
also handles Opera.

Hope this helps, Brendan. Let's un-ping Chris (who is back but working  
on other stuff) ;-)

- Hallvord R.

Received on Tuesday, 13 October 2009 21:17:15 UTC