- From: Brendan Eich <brendan@mozilla.org>
- Date: Tue, 13 Oct 2009 11:58:57 -0700
- To: Anne van Kesteren <annevk@opera.com>
- Cc: "Maciej Stachowiak" <mjs@apple.com>, "HTML WG" <public-html@w3.org>
On Oct 13, 2009, at 11:47 AM, Anne van Kesteren wrote: > On Tue, 13 Oct 2009 20:39:42 +0200, Brendan Eich > <brendan@mozilla.org> wrote: >> On Oct 13, 2009, at 11:19 AM, Anne van Kesteren wrote: >>> typeof gives undefined and ToBoolean gives false. I'm not sure >>> there's anything else. >> >> What about (document.all == undefined) and (document.all == null)? >> How about ===? These do not apply ToBoolean. > > All false. I haven't seen any logged issues on this either, but > admittedly I have not looked into it that much. I'm mostly trying to > wrap my head around some other specs. Okey dokey. :-/ I pinged Chris Pine of Opera, who may still be on leave but may know more. >> 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. 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. And typeof document.all == "undefined". That is simpler than what WebKit does, although as you noted it too conflicts with ECMA-262. 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. /be
Received on Tuesday, 13 October 2009 19:00:04 UTC