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
61 changes: 48 additions & 13 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -70445,8 +70445,8 @@ interface <dfn interface>HTMLTemplateElement</dfn> : <span>HTMLElement</span> {

<div algorithm>
<p>To <dfn>prepare content patching</dfn> given an <code>Element</code> or
<code>DocumentFragment</code> <var>scope</var> and a <code>template</code> element
<var>template</var>:</p>
<code>DocumentFragment</code> <var>scope</var>, a <code>template</code> element
<var>template</var>, and a <code>Document</code> <var>parserDocument</var>:</p>

<ol>
<li><p><span>Assert</span>: <var>template</var>'s <code data-x="attr-template-for">for</code>
Expand Down Expand Up @@ -70489,6 +70489,21 @@ interface <dfn interface>HTMLTemplateElement</dfn> : <span>HTMLElement</span> {
</ol>
</li>

<li><p>Let <var>scopeDocument</var> be <var>scope</var>'s <span>node document</span>.</p></li>

<li><p>Increment <var>scopeDocument</var>'s <span>throw-on-dynamic-markup-insertion
counter</span>.</p></li>

<li>
<p>If <var>parserDocument</var> is not <var>scopeDocument</var>, then increment
<var>parserDocument</var>'s <span>throw-on-dynamic-markup-insertion counter</span>.</p>

<p class="note"><var>parserDocument</var> can differ from <var>scopeDocument</var> when script
moves an <span>insertion target</span> into another document mid-parse, or in the <span>fragment
case</span> where <var>parserDocument</var> is the inert <code>Document</code> with which the
fragment parser is associated.</p>
</li>

<li>
<p>For each <var>node</var> of <var>removedNodes</var>:</p>

Expand All @@ -70505,6 +70520,12 @@ interface <dfn interface>HTMLTemplateElement</dfn> : <span>HTMLElement</span> {
</ol>
</li>

<li><p>If <var>parserDocument</var> is not <var>scopeDocument</var>, then decrement
<var>parserDocument</var>'s <span>throw-on-dynamic-markup-insertion counter</span>.</p></li>

<li><p>Decrement <var>scopeDocument</var>'s <span>throw-on-dynamic-markup-insertion
counter</span>.</p></li>

<li><p>Return true.</p></li>
</ol>
</div>
Expand Down Expand Up @@ -126543,12 +126564,14 @@ document.body.appendChild(frame)</code></pre>
<div w-nodev>

<p><code>Document</code> objects have a <dfn>throw-on-dynamic-markup-insertion counter</dfn>,
which is used in conjunction with the <span>create an element for the token</span> algorithm to
prevent <span data-x="custom element constructor">custom element constructors</span> from being
able to use <code data-x="dom-document-open">document.open()</code>, <code
which is used in conjunction with the <span>create an element for the token</span> and
<span>prepare content patching</span> algorithms to prevent scripts (such as <span data-x="custom
element constructor">custom element constructors</span> and <code
data-x="event-pagehide">pagehide</code> event handlers) from being able to use <code
data-x="dom-document-open">document.open()</code>, <code
data-x="dom-document-close">document.close()</code>, and <code
data-x="dom-document-write">document.write()</code> when they are invoked by the parser.
Initially, the counter must be set to zero.</p>
data-x="dom-document-write">document.write()</code> when they are invoked synchronously by tree
construction. Initially, the counter must be set to zero.</p>

</div>

Expand All @@ -126571,7 +126594,8 @@ document.body.appendChild(frame)</code></pre>
<code>Document</code> is an <span data-x="XML documents">XML document</span>.</p>

<p>Throws an <span>"<code>InvalidStateError</code>"</span> <code>DOMException</code> if the
parser is currently executing a <span>custom element constructor</span>.</p>
parser is currently executing a <span>custom element constructor</span> or removing nodes for a
<code>template</code> element's <code data-x="attr-template-for">for</code> attribute.</p>
</dd>

<dt><code data-x=""><var>window</var> = <var>document</var>.<span data-x="dom-document-open-window">open</span>(<var>url</var>, <var>name</var>, <var>features</var>)</code></dt>
Expand Down Expand Up @@ -126750,7 +126774,8 @@ document.body.appendChild(frame)</code></pre>
<code>Document</code> is an <span data-x="XML documents">XML document</span>.</p>

<p>Throws an <span>"<code>InvalidStateError</code>"</span> <code>DOMException</code> if the
parser is currently executing a <span>custom element constructor</span>.</p>
parser is currently executing a <span>custom element constructor</span> or removing nodes for a
<code>template</code> element's <code data-x="attr-template-for">for</code> attribute.</p>
</dd>
</dl>

Expand Down Expand Up @@ -126818,7 +126843,8 @@ document.body.appendChild(frame)</code></pre>
invoked on <span>XML documents</span>.</p>

<p>Throws an <span>"<code>InvalidStateError</code>"</span> <code>DOMException</code> if the
parser is currently executing a <span>custom element constructor</span>.</p>
parser is currently executing a <span>custom element constructor</span> or removing nodes for a
<code>template</code> element's <code data-x="attr-template-for">for</code> attribute.</p>
</dd>
</dl>

Expand Down Expand Up @@ -126937,7 +126963,8 @@ document.body.appendChild(frame)</code></pre>
invoked on <span>XML documents</span>.</p>

<p>Throws an <span>"<code>InvalidStateError</code>"</span> <code>DOMException</code> if the
parser is currently executing a <span>custom element constructor</span>.</p>
parser is currently executing a <span>custom element constructor</span> or removing nodes for a
<code>template</code> element's <code data-x="attr-template-for">for</code> attribute.</p>
</dd>
</dl>

Expand Down Expand Up @@ -147757,13 +147784,18 @@ dictionary <dfn dictionary>StorageEventInit</dfn> : <span>EventInit</span> {
<li><p>Let <var>willExecuteScript</var> be true if <var>definition</var> is non-null and the
parser's <span>fragment context element</span> is null; otherwise false.</p></li>

<li><p>Let <var>parserDocument</var> be the parser's <code>Document</code>.</p></li>

<li>
<p>If <var>willExecuteScript</var> is true:</p>

<ol>
<li><p>Increment <var>document</var>'s <span>throw-on-dynamic-markup-insertion
counter</span>.</p></li>

<li><p>If <var>parserDocument</var> is not <var>document</var>, then increment
<var>parserDocument</var>'s <span>throw-on-dynamic-markup-insertion counter</span>.</p></li>

<li><p>If the <span>JavaScript execution context stack</span> is empty, then <span>perform a
microtask checkpoint</span>.</p></li>

Expand Down Expand Up @@ -147815,6 +147847,9 @@ dictionary <dfn dictionary>StorageEventInit</dfn> : <span>EventInit</span> {

<li><p><span>Invoke custom element reactions</span> in <var>queue</var>.</p></li>

<li><p>If <var>parserDocument</var> is not <var>document</var>, then decrement
<var>parserDocument</var>'s <span>throw-on-dynamic-markup-insertion counter</span>.</p></li>

<li><p>Decrement <var>document</var>'s <span>throw-on-dynamic-markup-insertion
counter</span>.</p></li>
</ol>
Expand Down Expand Up @@ -149086,8 +149121,8 @@ document.body.appendChild(text);
</li>

<li><p>Let <var>success</var> be the result of <span data-x="prepare content
patching">preparing content patching</span> given <var>scope</var> and
<var>template</var>.</p></li>
patching">preparing content patching</span> given <var>scope</var>, <var>template</var>,
and the parser's <code>Document</code>.</p></li>

<li><p>If <var>success</var> is false, then <span>insert an element at the
adjusted insertion location</span> with <var>template</var>,
Expand Down
Loading