Skip to content

Commit 73de9e5

Browse files
authored
Pass better ancestor/root information to (re)moving steps
For removing steps and moving steps, instead of passing only oldParent (which is null when the removed node is not the root of the removed subtree), pass both isSubtreeRoot and oldAncestor (renamed from oldParent because it's not always a parent now). This is the DOM spec part of the fix for whatwg/html#12098.
1 parent 606ca76 commit 73de9e5

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

dom.bs

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2994,8 +2994,9 @@ null.
29942994
<div algorithm>
29952995
<p><a lt="Other applicable specifications">Specifications</a> may define
29962996
<dfn export id=concept-node-move-ext>moving steps</dfn> for all or some <a for=/>nodes</a>. The
2997-
algorithm is passed a <a for=/>node</a> <var>movedNode</var>, and a <a for=/>node</a>-or-null
2998-
<var ignore>oldParent</var> as indicated in the <a for=/>move</a> algorithm below. Like the
2997+
algorithm is passed a <a for=/>node</a> <var>movedNode</var>, a boolean
2998+
<var ignore>isSubtreeRoot</var>, and a <a for=/>node</a> <var ignore>oldAncestor</var>
2999+
as indicated in the <a for=/>move</a> algorithm below. Like the
29993000
<a>insertion steps</a>, these steps must not modify the <a>node tree</a> that
30003001
<var>movedNode</var> <a>participates</a> in, create <a for=/>browsing contexts</a>,
30013002
<a lt="fire an event">fire events</a>, or otherwise execute JavaScript. These steps may queue tasks
@@ -3107,14 +3108,16 @@ to do these things asynchronously, however.
31073108
<var>node</var>, in <a>shadow-including tree order</a>:
31083109

31093110
<ol>
3111+
<li><p>Let <var>isSubtreeRoot</var> be true if <var>inclusiveDescendant</var> is
3112+
<var>node</var>; otherwise false.
3113+
31103114
<li>
3111-
<p>If <var>inclusiveDescendant</var> is <var>node</var>, then run the <a>moving steps</a> with
3112-
<var>inclusiveDescendant</var> and <var>oldParent</var>. Otherwise, run the <a>moving steps</a>
3113-
with <var>inclusiveDescendant</var> and null.
3115+
<p>Run the <a>moving steps</a> with <var>inclusiveDescendant</var>, <var>isSubtreeRoot</var>,
3116+
and <var>oldParent</var>.
31143117

31153118
<p class="note">Because the <a>move</a> algorithm is a separate primitive from
3116-
<a for=/>insert</a> and <a for=/>remove</a>, it does not invoke the traditional
3117-
<a>insertion steps</a> or <a>removing steps</a> for <var>inclusiveDescendant</var>.
3119+
<a for=/>insert</a> and <a for=/>remove</a>, it does not invoke the <a>insertion steps</a>
3120+
or <a>removing steps</a> for <var>inclusiveDescendant</var>.
31183121
</li>
31193122

31203123
<li><p>If <var>inclusiveDescendant</var> is <a for=Element>custom</a> and <var>newParent</var> is
@@ -3270,9 +3273,9 @@ from a <a for=/>node</a> <var>parent</var>:
32703273
<div algorithm>
32713274
<p><a lt="Other applicable specifications">Specifications</a> may define
32723275
<dfn export id=concept-node-remove-ext>removing steps</dfn> for all or some <a for=/>nodes</a>. The
3273-
algorithm is passed a <a for=/>node</a> <var ignore>removedNode</var> and a
3274-
<a for=/>node</a>-or-null <var ignore>oldParent</var>, as indicated in the <a for=/>remove</a>
3275-
algorithm below.
3276+
algorithm is passed a <a for=/>node</a> <var ignore>removedNode</var>, a boolean
3277+
<var ignore>isSubtreeRoot</var>, and a <a for=/>node</a> <var ignore>oldAncestor</var> as indicated
3278+
in the <a for=/>remove</a> algorithm below.
32763279
</div>
32773280

32783281
<div algorithm=remove>
@@ -3313,7 +3316,7 @@ optional boolean <dfn for=remove><var>suppressObservers</var></dfn> (default fal
33133316
<li><p>Run <a>assign slottables for a tree</a> with <var>node</var>.
33143317
</ol>
33153318

3316-
<li><p>Run the <a>removing steps</a> with <var>node</var> and <var>parent</var>.
3319+
<li><p>Run the <a>removing steps</a> with <var>node</var>, true, and <var>parent</var>.
33173320

33183321
<li><p>Let <var>isParentConnected</var> be <var>parent</var>'s <a>connected</a>.
33193322

@@ -3330,7 +3333,7 @@ optional boolean <dfn for=remove><var>suppressObservers</var></dfn> (default fal
33303333
<a>shadow-including tree order</a>:
33313334

33323335
<ol>
3333-
<li><p>Run the <a>removing steps</a> with <var>descendant</var> and null.
3336+
<li><p>Run the <a>removing steps</a> with <var>descendant</var>, false, and <var>parent</var>.
33343337

33353338
<li><p>If <var>descendant</var> is <a for=Element>custom</a> and <var>isParentConnected</var>
33363339
is true, then <a>enqueue a custom element callback reaction</a> with <var>descendant</var>,

0 commit comments

Comments
 (0)