Skip to content

Commit

Permalink
Allow document.open()/write() to be called on non-active documents
Browse files Browse the repository at this point in the history
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 whatwg#2827).

Additionally, use a more appropriate guard for erasing event listeners
and handlers on the Window object, as revealed by the tests.

Fixes whatwg#2827.

Tests: web-platform-tests/wpt#12636
Tests: web-platform-tests/wpt#12770
  • Loading branch information
TimothyGu authored and mustaqahmed committed Feb 15, 2019
1 parent e3a7e06 commit ac574c0
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -90970,12 +90970,6 @@ document.body.appendChild(frame)</code></pre>
than 0, then throw an <span>"<code>InvalidStateError</code>"</span>
<code>DOMException</code>.</p></li>

<li><p>If <var>document</var> is not an <span>active document</span>, then return
<var>document</var>.</p></li>

<li><p>Let <var>window</var> be <var>document</var>'s <span>relevant global
object</span>.</p></li>

<li><p>Let <var>entryDocument</var> be the <span>responsible document</span> specified by the
<span>entry settings object</span>.</p></li>

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

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

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

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

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

<li><p>If <var>document</var> is not an <span>active document</span>, then return.</p></li>

<li>
<p>If the <span>insertion point</span> is undefined, then:

Expand Down

0 comments on commit ac574c0

Please sign in to comment.