Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 47 additions & 39 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -3151,6 +3151,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
<li><dfn data-x-href="https://dom.spec.whatwg.org/#interface-comment"><code>Comment</code></dfn> interface</li>
<li><dfn data-x-href="https://dom.spec.whatwg.org/#interface-domimplementation"><code>DOMImplementation</code></dfn> interface</li>
<li><dfn data-x="DOM Document" data-x-href="https://dom.spec.whatwg.org/#interface-document"><code>Document</code></dfn> interface</li>
<li><dfn data-x="XMLDocument" data-x-href="https://dom.spec.whatwg.org/#xmldocument"><code>XMLDocument</code></dfn> interface</li>
<li><dfn data-x="DOM DocumentOrShadowRoot" data-x-href="https://dom.spec.whatwg.org/#documentorshadowroot"><code>DocumentOrShadowRoot</code></dfn> interface</li>
<li><dfn data-x-href="https://dom.spec.whatwg.org/#interface-documentfragment"><code>DocumentFragment</code></dfn> interface</li>
<li><dfn data-x-href="https://dom.spec.whatwg.org/#interface-documenttype"><code>DocumentType</code></dfn> interface</li>
Expand Down Expand Up @@ -9313,6 +9314,8 @@ o.myself = o;</code></pre>
that can be set when the <code>Document</code> is created. If it is not explicitly set, then its
value is the empty string.</p>

<p>A <code>Document</code> instance with its <span data-x="concept-document-type">type</span>
set to "<code data-x="">xml</code>" inherits from <code>XMLDocument</code>.</p>

<h4>The <code>Document</code> object</h4>

Expand All @@ -9322,7 +9325,6 @@ o.myself = o;</code></pre>
<pre><code class="idl" data-x="">enum <dfn>DocumentReadyState</dfn> { "loading", "interactive", "complete" };
typedef (<span>HTMLScriptElement</span> or <span>SVGScriptElement</span>) <dfn>HTMLOrSVGScriptElement</dfn>;

[OverrideBuiltins]
partial interface <dfn id="document" data-lt="">Document</dfn> {
// <span>resource metadata management</span>
[PutForwards=<span data-x="dom-location-href">href</span>, Unforgeable] readonly attribute <span>Location</span>? <span data-x="dom-document-location">location</span>;
Expand All @@ -9332,8 +9334,6 @@ partial interface <dfn id="document" data-lt="">Document</dfn> {
readonly attribute DOMString <span data-x="dom-document-lastModified">lastModified</span>;
readonly attribute <span>DocumentReadyState</span> <span data-x="dom-document-readyState">readyState</span>;

// <span>DOM tree accessors</span>
<a href="#dom-document-nameditem">getter</a> object (DOMString name);
[<span>CEReactions</span>] attribute DOMString <span data-x="dom-document-title">title</span>;
[<span>CEReactions</span>] attribute DOMString <span data-x="dom-document-dir">dir</span>;
[<span>CEReactions</span>] attribute <span>HTMLElement</span>? <span data-x="dom-document-body">body</span>;
Expand Down Expand Up @@ -9396,6 +9396,21 @@ partial interface <dfn id="document" data-lt="">Document</dfn> {
data-x="concept-document-module-map">module map</dfn>, which is a <span>module map</span>,
initially empty.</p>

<h4>The <code>HTMLDocument</code> object</h4>

<p>For historical reasons <code>HTMLDocument</code> can't be a simple alias to <code>Document</code>:
see <a href="https://github.com/whatwg/html/issues/4792">issue #4792</a></p>

<p>The <span data-x="concept-document-type">type</span> of <code>HTMLDocument</code>
is always "<code data-x="">html</code>"</p>

<pre><code class="idl" data-x="">[Exposed=Window,
OverrideBuiltins]
interface <dfn>HTMLDocument</dfn> : <span>Document</span> {
// <span>DOM tree accessors</span>
<a href="#dom-htmldocument-nameditem">getter</a> object (DOMString name);
}</code></pre>

<h4>The <code>DocumentOrShadowRoot</code> interface</h4>

<p><cite>DOM</cite> defines the <code data-x="DOM
Expand Down Expand Up @@ -9944,9 +9959,9 @@ partial interface <dfn id="document" data-lt="">Document</dfn> {

<hr>

<p id="dom-document-namedItem-which">The <code>Document</code> interface <span data-x="support
named properties">supports named properties</span>. The <span>supported property names</span> of a
<code>Document</code> object <var>document</var> at any moment consist of the following, in
<p id="dom-htmldocument-namedItem-which">The <code>HTMLDocument</code> interface <span data-x="support
named properties">supports named properties</span>. The <span>supported property names</span> of an
<code>HTMLDocument</code> object <var>document</var> at any moment consist of the following, in
<span>tree order</span> according to the element that contributed them, ignoring later duplicates,
and with values from <code data-x="attr-id">id</code> attributes coming before values from <code
data-x="">name</code> attributes when the same element contributes both:</p>
Expand All @@ -9970,17 +9985,17 @@ partial interface <dfn id="document" data-lt="">Document</dfn> {
document tree</span> with <var>document</var> as their <span>root</span>.</p></li>
</ul>

<p id="dom-document-nameditem">To <span>determine the value of a named property</span>
<var>name</var> for a <code>Document</code>, the user agent must return the value obtained using
the following steps:</p>
<p id="dom-htmldocument-nameditem">To <span>determine the value of a named property</span>
<var>name</var> for an <code>HTMLDocument</code>, the user agent must return the value obtained
using the following steps:</p>

<ol>

<li>

<p>Let <var>elements</var> be the list of <span data-x="dom-document-namedItem-filter">named
<p>Let <var>elements</var> be the list of <span data-x="dom-htmldocument-namedItem-filter">named
elements</span> with the name <var>name</var> that are <span>in a document tree</span> with the
<code>Document</code> as their <span>root</span>.</p>
<code>HTMLDocument</code> as their <span>root</span>.</p>

<p class="note">There will be at least one such element, by definition.<!-- (If there wasn't,
then this algorithm wouldn't have been invoked by Web IDL.) --></p>
Expand All @@ -10004,8 +10019,8 @@ partial interface <dfn id="document" data-lt="">Document</dfn> {

<li>

<p>Otherwise return an <code>HTMLCollection</code> rooted at the <code>Document</code> node,
whose filter matches only <span data-x="dom-document-namedItem-filter">named elements</span> with
<p>Otherwise return an <code>HTMLCollection</code> rooted at the <code>HTMLDocument</code> node,
whose filter matches only <span data-x="dom-htmldocument-namedItem-filter">named elements</span> with
the name <var>name</var>.</p> <!-- the same one each time is returned, because of the
rule under collections -->

Expand All @@ -10019,7 +10034,8 @@ partial interface <dfn id="document" data-lt="">Document</dfn> {

</ol>

<p><dfn data-x="dom-document-nameditem-filter">Named elements</dfn> with the name <var>name</var>, for the purposes of the above algorithm, are those that are either:</p>
<p><dfn data-x="dom-htmldocument-nameditem-filter">Named elements</dfn> with the name <var>name</var>,
for the purposes of the above algorithm, are those that are either:</p>

<!-- KEEP THIS LIST IN SYNC WITH SUPPORTED PROPERTY VALUES ABOVE -->
<ul>
Expand Down Expand Up @@ -59691,13 +59707,13 @@ interface <dfn>HTMLTemplateElement</dfn> : <span>HTMLElement</span> {

<ol>

<li><p>Let <var>new doc</var> be a new <code>Document</code> (whose <span
data-x="concept-document-bc">browsing context</span> is null). This is "a
<code>Document</code> created by this algorithm" for the purposes of the step above.</p></li>
<li><p>If <var>doc</var> is an <span data-x="HTML documents">HTML document</span>,
let <var>new doc</var> be a new <code>HTMLDocument</code>.</p></li>

<li><p>If <var>doc</var> is an <span data-x="HTML documents">HTML document</span>, mark
<var>new doc</var> as an <span data-x="HTML documents">HTML document</span>
also.</p></li>
<li><p>Otherwise, let <var>new doc</var> be a new <code>XMLDocument</code>.</p></li>
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously, this would’ve resulted in a Document with a default type.


<li><p><var>new doc</var> (whose <span data-x="concept-document-bc">browsing context</span> is null)
is "a <code>Document</code> created by this algorithm" for the purposes of the step above.</p></li>

<li><p>Let <var>doc</var>'s <span>associated inert template document</span> be <var>new doc</var>.</p></li>

Expand Down Expand Up @@ -78474,7 +78490,7 @@ dictionary <dfn>DragEventInit</dfn> : <span>MouseEventInit</span> {
<li><p><span>Set up a window environment settings object</span> with <var>realm execution
context</var>, and let <var>settingsObject</var> be the result.</p></li>

<li><p>Let <var>document</var> be a new <code>Document</code>, marked as an <span data-x="HTML
<li><p>Let <var>document</var> be a new <code>HTMLDocument</code>, marked as an <span data-x="HTML
documents">HTML document</span> in <span>quirks mode</span>, whose <span
data-x="concept-document-content-type">content type</span> is "<code data-x="">text/html</code>",
<span>origin</span> is <var>origin</var>, <span>active sandboxing flag set</span> is
Expand Down Expand Up @@ -79828,12 +79844,6 @@ dictionary <dfn>WindowPostMessageOptions</dfn> : <span>PostMessageOptions</span>
context</span>'s <code>WindowProxy</code> object.</p></li>
</ol>

<hr>

<p>For historical reasons, <code>Window</code> objects must also have a writable, configurable,
non-enumerable property named <dfn><code>HTMLDocument</code></dfn> whose value is the
<code>Document</code> <span>interface object</span>.</p>

</div>


Expand Down Expand Up @@ -84273,12 +84283,15 @@ interface <dfn>Location</dfn> { // but see also <a href="#the-location-interface
</ol>
</li>

<li><p>Let <var>document</var> be a new <code>Document</code>, whose <span
data-x="concept-document-type">type</span> is <var>type</var>, <span
data-x="concept-document-content-type">content type</span> is <var>contentType</var>,
<span>origin</span> is <var>origin</var>, <span data-x="concept-document-feature-policy">feature
policy</span> is <var>featurePolicy</var>, and <span>active sandboxing flag set</span> is
<var>finalSandboxFlags</var>.</p></li>
<li><p>If <var>type</var> is "html", then let <var>document</var>
be a new <code>HTMLDocument</code>.</p></li>

<li><p>Otherwise, let <var>document</var> be a new <code>XMLDocument</code>.</p></li>

<li><p>Set <var>document</var>'s <span data-x="concept-document-content-type">content type</span>
to <var>contentType</var>, <span>origin</span> to <var>origin</var>,
<span data-x="concept-document-feature-policy">feature policy</span> to <var>featurePolicy</var>,
and <span>active sandboxing flag set</span> to <var>finalSandboxFlags</var>.</p></li>

<li id="set-the-document's-address"><p>If <var>request</var> is non-null, then set
<var>document</var>'s <span data-x="concept-document-url">URL</span> to <var>request</var>'s
Expand Down Expand Up @@ -113261,12 +113274,7 @@ console.assert(container.firstChild instanceof SuperP);

<ol>

<li>

<p>Create a new <code>Document</code> node, and mark it as being an <span data-x="HTML
documents">HTML document</span>.</p>

</li>
<li><p>Create a new <code>HTMLDocument</code> node.</p></li>

<li>

Expand Down