Skip to content

Commit be5f269

Browse files
authored
Fix source insertion/moving/removing steps
As discovered in #10657, no browser's removing or moving steps rely on the 'next sibling' pointer associated with the old element's position. After writing a test, we also discovered that the same goes for the insertion steps. In all cases, when the parent (old parent, for removing/moving steps) is a <picture> element, a relevant mutation is triggered for all <img> children of the parent. Update the spec to reflect this. Closes #11113.
1 parent 74cd7a2 commit be5f269

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

source

+18-10
Original file line numberDiff line numberDiff line change
@@ -29179,34 +29179,42 @@ interface <dfn interface>HTMLSourceElement</dfn> : <span>HTMLElement</span> {
2917929179
<var>insertedNode</var>, are:</p>
2918029180

2918129181
<ol>
29182-
<li><p>If <var>insertedNode</var>'s parent is a <span>media element</span> that has no <code
29182+
<li><p>Let <var>parent</var> be <var>insertedNode</var>'s <span>parent</span>.</p></li>
29183+
29184+
<li><p>If <var>parent</var> is a <span>media element</span> that has no <code
2918329185
data-x="attr-media-src">src</code> attribute and whose <code
2918429186
data-x="dom-media-networkState">networkState</code> has the value <code
2918529187
data-x="dom-media-NETWORK_EMPTY">NETWORK_EMPTY</code>, then invoke that <span>media
2918629188
element</span>'s <span data-x="concept-media-load-algorithm">resource selection
2918729189
algorithm</span>.</p></li>
2918829190

29189-
<li><p>If <var>insertedNode</var>'s next sibling is an <code>img</code> element and its parent is
29190-
a <code>picture</code> element, then, count this as a <span data-x="relevant mutations">relevant
29191-
mutation</span> for the <code>img</code> element.</p></li>
29191+
<li><p>If <var>parent</var> is a <code>picture</code> element, then <span data-x="list
29192+
iterate">for each</span> <var>child</var> of <var>parent</var>'s <span
29193+
data-x="concept-tree-child">children</span>, if <var>child</var> is an <code>img</code> element,
29194+
then count this as a <span data-x="relevant mutations">relevant mutation</span> for
29195+
<var>child</var>.</p></li>
2919229196
</ol>
2919329197

2919429198
<p>The <code>source</code> <span>HTML element moving steps</span>, given <var>movedNode</var> and
2919529199
<var>oldParent</var>, are:</p>
2919629200

2919729201
<ol>
29198-
<li><p>If <var>movedNode</var>'s next sibling was an <code>img</code> element and
29199-
<var>oldParent</var> is a <code>picture</code> element, then, count this as a <span
29200-
data-x="relevant mutations">relevant mutation</span> for the <code>img</code> element.</p></li>
29202+
<li><p>If <var>oldParent</var> is a <code>picture</code> element, then <span data-x="list
29203+
iterate">for each</span> <var>child</var> of <var>oldParent</var>'s <span
29204+
data-x="concept-tree-child">children</span>, if <var>child</var> is an <code>img</code> element,
29205+
then count this as a <span data-x="relevant mutations">relevant mutation</span> for
29206+
<var>child</var>.</p></li>
2920129207
</ol>
2920229208

2920329209
<p>The <code>source</code> <span>HTML element removing steps</span>, given <var>removedNode</var>
2920429210
and <var>oldParent</var>, are:</p>
2920529211

2920629212
<ol>
29207-
<li><p>If <var>removedNode</var>'s next sibling was an <code>img</code> element and
29208-
<var>oldParent</var> is a <code>picture</code> element, then, count this as a <span
29209-
data-x="relevant mutations">relevant mutation</span> for the <code>img</code> element.</p></li>
29213+
<li><p>If <var>oldParent</var> is a <code>picture</code> element, then <span data-x="list
29214+
iterate">for each</span> <var>child</var> of <var>oldParent</var>'s <span
29215+
data-x="concept-tree-child">children</span>, if <var>child</var> is an <code>img</code> element,
29216+
then count this as a <span data-x="relevant mutations">relevant mutation</span> for
29217+
<var>child</var>.</p></li>
2921029218
</ol>
2921129219

2921229220
<p>The IDL attributes <dfn attribute for="HTMLSourceElement"><code

0 commit comments

Comments
 (0)