Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve integration with DOM's cloning steps #10859

Merged
merged 3 commits into from
Dec 17, 2024
Merged
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
57 changes: 30 additions & 27 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -3317,8 +3317,11 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
<li>The terms <dfn data-x-href="https://dom.spec.whatwg.org/#concept-document-quirks">quirks mode</dfn>,
<dfn data-x-href="https://dom.spec.whatwg.org/#concept-document-limited-quirks">limited-quirks mode</dfn>, and
<dfn data-x-href="https://dom.spec.whatwg.org/#concept-document-no-quirks">no-quirks mode</dfn></li>
<li>The algorithm to <dfn data-x="concept-node-clone" data-x-href="https://dom.spec.whatwg.org/#concept-node-clone">clone</dfn> a <code>Node</code>, and the concept of
<dfn data-x="concept-node-clone-ext" data-x-href="https://dom.spec.whatwg.org/#concept-node-clone-ext">cloning steps</dfn> used by that algorithm</li>
<li>The algorithm <dfn data-x="concept-node-clone" data-x-href="https://dom.spec.whatwg.org/#concept-node-clone">clone a node</dfn> with its arguments
<dfn data-x="concept-node-clone-document" data-x-href="https://dom.spec.whatwg.org/#clone-a-node-document"><var>document</var></dfn>,
<dfn data-x="concept-node-clone-subtree" data-x-href="https://dom.spec.whatwg.org/#clone-a-node-subtree"><var>subtree</var></dfn>, and
<dfn data-x="concept-node-clone-parent" data-x-href="https://dom.spec.whatwg.org/#clone-a-node-parent"><var>parent</var></dfn>, and the concept of
<dfn data-x="concept-node-clone-ext" data-x-href="https://dom.spec.whatwg.org/#concept-node-clone-ext">cloning steps</dfn></li>
<li>The concept of <dfn>base URL change steps</dfn> and the definition of what happens when an element is <dfn>affected by a base URL change</dfn></li>
<li>The concept of an element's <dfn data-x="concept-id" data-x-href="https://dom.spec.whatwg.org/#concept-id">unique identifier (ID)</dfn></li>
<li>The concept of an element's <dfn data-x="concept-class" data-x-href="https://dom.spec.whatwg.org/#concept-class">classes</dfn></li>
Expand Down Expand Up @@ -7713,9 +7716,9 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
</ol>

<p>The <span data-x="concept-node-clone-ext">cloning steps</span> for elements that
<span>include</span> <code>HTMLOrSVGElement</code> must set the
<span>[[CryptographicNonce]]</span> slot on the copy to the value of the slot on the element being
cloned.</p>
<span>include</span> <code>HTMLOrSVGElement</code> given <var>node</var>, <var>copy</var>, and
<var>subtree</var> are to set <var>copy</var>'s <span>[[CryptographicNonce]]</span> to
<var>node</var>'s <span>[[CryptographicNonce]]</span>.</p>

<h4>Lazy loading attributes</h4>

Expand Down Expand Up @@ -48236,11 +48239,11 @@ interface <dfn interface>HTMLInputElement</dfn> : <span>HTMLElement</span> {
</div>

<p>The <span data-x="concept-node-clone-ext">cloning steps</span> for <code>input</code> elements
must propagate the <span data-x="concept-fe-value">value</span>, <span
data-x="concept-fe-dirty">dirty value flag</span>, <span
data-x="concept-fe-checked">checkedness</span>, and <span
data-x="concept-input-checked-dirty-flag">dirty checkedness flag</span> from the node being cloned
to the copy.</p>
given <var>node</var>, <var>copy</var>, and <var>subtree</var> are to propagate the <span
data-x="concept-fe-value">value</span>, <span data-x="concept-fe-dirty">dirty value flag</span>,
<span data-x="concept-fe-checked">checkedness</span>, and <span
data-x="concept-input-checked-dirty-flag">dirty checkedness flag</span> from <var>node</var> to
<var>copy</var>.</p>

<p>The <span>activation behavior</span> for <code>input</code> elements <var>element</var>, given
<var>event</var>, are these steps:</p>
Expand Down Expand Up @@ -54846,8 +54849,9 @@ interface <dfn interface>HTMLTextAreaElement</dfn> : <span>HTMLElement</span> {
data-x="concept-textarea-raw-value">raw value</span>.</p>

<p>The <span data-x="concept-node-clone-ext">cloning steps</span> for <code>textarea</code>
elements must propagate the <span data-x="concept-textarea-raw-value">raw value</span> and <span
data-x="concept-fe-dirty">dirty value flag</span> from the node being cloned to the copy.</p>
elements given <var>node</var>, <var>copy</var>, and <var>subtree</var> are to propagate the <span
data-x="concept-textarea-raw-value">raw value</span> and <span data-x="concept-fe-dirty">dirty
value flag</span> from <var>node</var> to <var>node</var>.</p>

<p>The <span>children changed steps</span> for <code>textarea</code> elements must, if the
element's <span data-x="concept-fe-dirty">dirty value flag</span> is false, set the element's
Expand Down Expand Up @@ -62849,9 +62853,10 @@ o............A....e
<var>el</var> does not have an <code data-x="attr-script-async">async</code> or <code
data-x="attr-script-defer">defer</code> attribute.</p>

<p>The <span data-x="concept-node-clone-ext">cloning steps</span> for a <code>script</code>
element <var>el</var> being cloned to a copy <var>copy</var> are to set <var>copy</var>'s
<span>already started</span> to <var>el</var>'s <span>already started</span>.</p>
<p>The <span data-x="concept-node-clone-ext">cloning steps</span> for <code>script</code>
elements given <var>node</var>, <var>copy</var>, and <var>subtree</var> are to set
<var>copy</var>'s <span>already started</span> to <var>node</var>'s <span>already
started</span>.</p>

<p>When an <code data-x="attr-script-async">async</code> attribute is added to a
<code>script</code> element <var>el</var>, the user agent must set <var>el</var>'s
Expand Down Expand Up @@ -64254,21 +64259,19 @@ interface <dfn interface>HTMLTemplateElement</dfn> : <span>HTMLElement</span> {

<hr>

<p>The <span data-x="concept-node-clone-ext">cloning steps</span> for a <code>template</code>
element <var>node</var> being cloned to a copy <var>copy</var> must run the
following steps:</p>
<p>The <span data-x="concept-node-clone-ext">cloning steps</span> for <code>template</code>
elements given <var>node</var>, <var>copy</var>, and <var>subtree</var> are:</p>
annevk marked this conversation as resolved.
Show resolved Hide resolved

<ol>
<li><p>If the <var>clone children flag</var> is not set in the calling <span
data-x="concept-node-clone">clone</span> algorithm, return.</p></li>

<li><p>Let <var>copied contents</var> be the result of <span
data-x="concept-node-clone">cloning</span> all the children of <var>node</var>'s
<span>template contents</span>, with <var>document</var> set to <var>copy</var>'s <span>template contents</span>'s <span>node
document</span>, and with the <var>clone children
flag</var> set.</p></li>
<li><p>If <var>subtree</var> is false, then return.</p></li>

<li><p>Append <var>copied contents</var> to <var>copy</var>'s <span>template
<li><p>For each <var>child</var> of <var>node</var>'s <span>template contents</span>'s <span
data-x="concept-tree-child">children</span>, in <span>tree order</span>: <span
data-x="concept-node-clone">clone a node</span> given <var>child</var> with <span
data-x="concept-node-clone-document"><i>document</i></span> set to <var>copy</var>'s
<span>template contents</span>'s <span>node document</span>, <span
data-x="concept-node-clone-subtree"><i>subtree</i></span> set to true, and <span
data-x="concept-node-clone-parent"><i>parent</i></span> set to <var>copy</var>'s <span>template
contents</span>.</p></li>
</ol>

Expand Down