This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 20436 - document.all equality comparison language is imprecise
Summary: document.all equality comparison language is imprecise
Status: RESOLVED FIXED
Alias: None
Product: WHATWG
Classification: Unclassified
Component: HTML (show other bugs)
Version: unspecified
Hardware: Other other
: P3 normal
Target Milestone: Unsorted
Assignee: Ian 'Hixie' Hickson
QA Contact: contributor
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-12-18 19:26 UTC by Jeff Walden (remove +w3 to email)
Modified: 2013-01-05 03:55 UTC (History)
2 users (show)

See Also:


Attachments

Description Jeff Walden (remove +w3 to email) 2012-12-18 19:26:45 UTC
The ==/!= commentary definitely says that document.all == undefined.  But it's not made clear the exact mechanism by which this is performed.

One plausible reading is that when performing comparisons, undefined should substitute for document.all objects in comparisons.  This would make document.all == undefined, and it would make document.all == null, both of which are the case in browsers.  But it would also make window1.document.all == window2.document.all, which I don't think is the case, nor should it be.  See http://software.hixie.ch/utilities/js/live-dom-viewer/saved/2028 for a testcase.

The best alternative reading is that the language says only that document.all == undefined, and !(document.all != undefined) -- but that doesn't speak to the behavior of comparisons to null, which should work akin to comparisons to undefined.  Regardless which interpretation might be considered best (and I think reasonable people could disagree on this), the current language is either unclear or incomplete.

The language should be changed to make clear that document.all == undefined and document.all == null, but document.all != otherWindow.document.all.  Changing this phrase in the current language:

"the object returned for all is equal to the undefined value"

to this:

"the object returned for all compares equal to the undefined value and compares equal to the null value"

should clarify matters.  Although, I do think it would be good to explicitly say that ==/!= comparisons to other values (booleans, numbers, strings, and objects) are unaffected.  Mentioning that ===/!== is unaffected would also be nice.
Comment 1 Ian 'Hixie' Hickson 2012-12-31 04:56:25 UTC
I used language similar to what you suggest, but let me know if in my massaging the prose to be more in my voice I ended up butchering your key clarification. :-)
Comment 2 contributor 2012-12-31 04:57:21 UTC
Checked in as WHATWG revision r7624.
Check-in comment: Clarify the document.all black magic.
http://html5.org/tools/web-apps-tracker?from=7623&to=7624
Comment 3 Jeff Walden (remove +w3 to email) 2012-12-31 15:59:41 UTC
I think that covers it.  Thanks!
Comment 4 Ian 'Hixie' Hickson 2013-01-05 03:55:19 UTC
Thank _you_!