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

Re: typeof document.all

From: Brendan Eich <brendan@mozilla.org>
Date: Tue, 13 Oct 2009 13:50:02 -0700
Cc: "Maciej Stachowiak" <mjs@apple.com>, "HTML WG" <public-html@w3.org>
Message-Id: <6B7CD1CD-4BA0-4B51-82C3-92216521B6C5@mozilla.org>
To: Anne van Kesteren <annevk@opera.com>
On Oct 13, 2009, at 12:20 PM, Anne van Kesteren wrote:

> On Tue, 13 Oct 2009 20:58:57 +0200, Brendan Eich  
> <brendan@mozilla.org> wrote:
>> But according to bugs I've cited, see
>>
>> https://bugzilla.mozilla.org/show_bug.cgi?id=253150#c4
>> https://bugzilla.mozilla.org/show_bug.cgi?id=253150#c12
>> https://bugzilla.mozilla.org/attachment.cgi?id=154617
>>
>> it was not, and by default we presume is not, web-compatible.
>>
>> Indeed Google codesearch discloses:
>>
>> http://www.google.com/codesearch?hl=en&lr=&q=lang%3Ajavascript+%22.all+%3D%3D+undefined%22&sbtn=Search
>> http://www.google.com/codesearch?hl=en&lr=&q=lang%3Ajavascript+%22.all+!%3D+undefined%22&sbtn=Search
>> http://www.google.com/codesearch?hl=en&lr=&q=lang%3Ajavascript+%22.all+%3D%3D+null%22&sbtn=Search
>> http://www.google.com/codesearch?hl=en&lr=&q=lang%3Ajavascript+%22.all+!%3D+null%22&sbtn=Search
>>
>> So I don't think what you describe, if that's all Opera does, is  
>> sufficient, because false != null and false != undefined.
>
> I quickly skimmed through these and it seems most have something  
> special for Opera, are part of a comment, or are part of the Gecko  
> codebase, or something to that effect.

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

There are others like that. I don't know if it works on Opera due to  
some predicate condition in the control flow, though.


> Anyway, yeah, maybe we should be more like WebKit. Good reason to  
> get this all defined :-)


I agree we need some specification, the question is how much. You have  
an object that converts to false in boolean contexts, and of course it  
masquerades as undefined to typeof. But undefined converts to false  
and compares == (not ===) null. You might just need to change a false  
to undefined, and you win.

/be
Received on Tuesday, 13 October 2009 20:51:04 UTC

This archive was generated by hypermail 2.3.1 : Monday, 29 September 2014 09:39:09 UTC