Skip to content

Commit ad541d6

Browse files
TimothyGudomenic
authored andcommitted
Allow document.open()/write() to be called on non-active documents
There is no longer anything fundamental that prevents document.open() from being useful on non-active documents. This also aligns with Chrome, Edge, and Safari. In fact, some developers already utilize this property as a streaming HTML parser to desirable effect (see #2827). Additionally, use a more appropriate guard for erasing event listeners and handlers on the Window object, as revealed by the tests. Fixes #2827. Tests: web-platform-tests/wpt#12636 Tests: web-platform-tests/wpt#12770
1 parent cd9aab6 commit ad541d6

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

source

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -90970,12 +90970,6 @@ document.body.appendChild(frame)</code></pre>
9097090970
than 0, then throw an <span>"<code>InvalidStateError</code>"</span>
9097190971
<code>DOMException</code>.</p></li>
9097290972

90973-
<li><p>If <var>document</var> is not an <span>active document</span>, then return
90974-
<var>document</var>.</p></li>
90975-
90976-
<li><p>Let <var>window</var> be <var>document</var>'s <span>relevant global
90977-
object</span>.</p></li>
90978-
9097990973
<li><p>Let <var>entryDocument</var> be the <span>responsible document</span> specified by the
9098090974
<span>entry settings object</span>.</p></li>
9098190975

@@ -91002,13 +90996,17 @@ document.body.appendChild(frame)</code></pre>
9100290996
handler while the <code>Document</code> is being unloaded.</p>
9100390997
</li>
9100490998

91005-
<li><p><span data-x="abort a document">Abort</span> <var>document</var>.</p></li>
90999+
<li><p>If <var>document</var> is an <span>active document</span>, then <span data-x="abort a
91000+
document">abort</span> <var>document</var>.</p></li>
9100691001

9100791002
<li><p>For each <span>shadow-including inclusive descendant</span> <var>node</var> of
9100891003
<var>document</var>, <span>erase all event listeners and handlers</span> given
9100991004
<var>node</var>.</p></li>
9101091005

91011-
<li><p><span>Erase all event listeners and handlers</span> given <var>window</var>.</p></li>
91006+
<li><p>If <var>document</var> is the <span data-x="concept-document-window">associated
91007+
<code>Document</code></span> of <var>document</var>'s <span>relevant global object</span>, then
91008+
<span>erase all event listeners and handlers</span> given <var>document</var>'s <span>relevant
91009+
global object</span>.</p></li>
9101291010

9101391011
<li><p><span data-x="concept-node-replace-all">Replace all</span> with null within
9101491012
<var>document</var>, without firing any mutation events.</p></li>
@@ -91199,8 +91197,6 @@ document.body.appendChild(frame)</code></pre>
9119991197
than 0, then throw an <span>"<code>InvalidStateError</code>"</span>
9120091198
<code>DOMException</code>.</p></li>
9120191199

91202-
<li><p>If <var>document</var> is not an <span>active document</span>, then return.</p></li>
91203-
9120491200
<li>
9120591201
<p>If the <span>insertion point</span> is undefined, then:
9120691202

0 commit comments

Comments
 (0)