Skip to content

Commit f3c4fe0

Browse files
authored
Improve integration with DOM's cloning steps
Corresponding DOM PR: whatwg/dom#1334.
1 parent 5741c3a commit f3c4fe0

File tree

1 file changed

+30
-27
lines changed

1 file changed

+30
-27
lines changed

source

+30-27
Original file line numberDiff line numberDiff line change
@@ -3317,8 +3317,11 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
33173317
<li>The terms <dfn data-x-href="https://dom.spec.whatwg.org/#concept-document-quirks">quirks mode</dfn>,
33183318
<dfn data-x-href="https://dom.spec.whatwg.org/#concept-document-limited-quirks">limited-quirks mode</dfn>, and
33193319
<dfn data-x-href="https://dom.spec.whatwg.org/#concept-document-no-quirks">no-quirks mode</dfn></li>
3320-
<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
3321-
<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>
3320+
<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
3321+
<dfn data-x="concept-node-clone-document" data-x-href="https://dom.spec.whatwg.org/#clone-a-node-document"><var>document</var></dfn>,
3322+
<dfn data-x="concept-node-clone-subtree" data-x-href="https://dom.spec.whatwg.org/#clone-a-node-subtree"><var>subtree</var></dfn>, and
3323+
<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
3324+
<dfn data-x="concept-node-clone-ext" data-x-href="https://dom.spec.whatwg.org/#concept-node-clone-ext">cloning steps</dfn></li>
33223325
<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>
33233326
<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>
33243327
<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>
@@ -7713,9 +7716,9 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
77137716
</ol>
77147717

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

77207723
<h4>Lazy loading attributes</h4>
77217724

@@ -48236,11 +48239,11 @@ interface <dfn interface>HTMLInputElement</dfn> : <span>HTMLElement</span> {
4823648239
</div>
4823748240

4823848241
<p>The <span data-x="concept-node-clone-ext">cloning steps</span> for <code>input</code> elements
48239-
must propagate the <span data-x="concept-fe-value">value</span>, <span
48240-
data-x="concept-fe-dirty">dirty value flag</span>, <span
48241-
data-x="concept-fe-checked">checkedness</span>, and <span
48242-
data-x="concept-input-checked-dirty-flag">dirty checkedness flag</span> from the node being cloned
48243-
to the copy.</p>
48242+
given <var>node</var>, <var>copy</var>, and <var>subtree</var> are to propagate the <span
48243+
data-x="concept-fe-value">value</span>, <span data-x="concept-fe-dirty">dirty value flag</span>,
48244+
<span data-x="concept-fe-checked">checkedness</span>, and <span
48245+
data-x="concept-input-checked-dirty-flag">dirty checkedness flag</span> from <var>node</var> to
48246+
<var>copy</var>.</p>
4824448247

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

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

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

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

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

6425564260
<hr>
6425664261

64257-
<p>The <span data-x="concept-node-clone-ext">cloning steps</span> for a <code>template</code>
64258-
element <var>node</var> being cloned to a copy <var>copy</var> must run the
64259-
following steps:</p>
64262+
<p>The <span data-x="concept-node-clone-ext">cloning steps</span> for <code>template</code>
64263+
elements given <var>node</var>, <var>copy</var>, and <var>subtree</var> are:</p>
6426064264

6426164265
<ol>
64262-
<li><p>If the <var>clone children flag</var> is not set in the calling <span
64263-
data-x="concept-node-clone">clone</span> algorithm, return.</p></li>
64264-
64265-
<li><p>Let <var>copied contents</var> be the result of <span
64266-
data-x="concept-node-clone">cloning</span> all the children of <var>node</var>'s
64267-
<span>template contents</span>, with <var>document</var> set to <var>copy</var>'s <span>template contents</span>'s <span>node
64268-
document</span>, and with the <var>clone children
64269-
flag</var> set.</p></li>
64266+
<li><p>If <var>subtree</var> is false, then return.</p></li>
6427064267

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

0 commit comments

Comments
 (0)