W3C home > Mailing lists > Public > public-html@w3.org > October 2009

Re: typeof document.all

From: <hallvord@opera.com>
Date: Tue, 13 Oct 2009 21:16:35 +0000
Message-ID: <20091013211635.2knngs8uqx6os48s@staff.opera.com>
To: Brendan Eich <brendan@mozilla.org>
Cc: Anne van Kesteren <annevk@opera.com>, Maciej Stachowiak <mjs@apple.com>, HTML WG <public-html@w3.org>
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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 9 May 2012 00:16:50 GMT