Discussion:
[whatwg] Is the "document" identifier defined in the standards?
Kevin Chen
2017-04-24 05:01:26 UTC
Permalink
Hello,
Looking through the DOM and HTML standards I have seen several implicit references to the current document object using the identifier "document". But I do not see a guarantee within the standards that the browser will provide an object called "document" containing the current document object (irrespective of the fact that this does seem to be the case in practice). So I'm wondering if this convention actually is codified as a standard, or whether it remains a de facto standard only.

Thanks for your answers.-Kevin
Domenic Denicola
2017-04-24 05:14:11 UTC
Permalink
Post by Kevin Chen
But I do not see a guarantee within the standards that the browser will provide an object called "document" containing the current document object (irrespective of the fact that this does seem to be the case in practice).
This is specified at https://html.spec.whatwg.org/#window as
Post by Kevin Chen
[Unforgeable] readonly attribute Document document;
and if you click on "document" there it takes you to https://html.spec.whatwg.org/#dom-document-2 which says
Post by Kevin Chen
The document IDL attribute, on getting, must return this Window object's associated
Loading...