Skip to content

Commit 003549c

Browse files
authored
Make initialize() upgrade and fix upgrade()
CustomElementRegistry's upgrade() wasn't adjusted for scoped registries and we decided that initialize() should upgrade as well (but not into shadow trees as upgrade() does). The initialize() design here favors a single tree traversal for setting the registry and then upgrading the element. Tests: - web-platform-tests/wpt#56034 - web-platform-tests/wpt#56132 Fixes #11858 and fixes #11908.
1 parent 81e261f commit 003549c

File tree

1 file changed

+37
-14
lines changed

1 file changed

+37
-14
lines changed

source

Lines changed: 37 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -77277,12 +77277,19 @@ fetch(articleURL)
7727777277
are:</p>
7727877278

7727977279
<ol>
77280-
<li><p>Let <var>candidates</var> be a <span>list</span> of all of <var>root</var>'s
77281-
<span>shadow-including inclusive descendant</span> elements, in <span>shadow-including tree
77282-
order</span>.</p></li>
77280+
<li>
77281+
<p>For each <span>shadow-including inclusive descendant</span> <var>candidate</var> of
77282+
<var>root</var>, in <span>shadow-including tree order</span>:</p>
77283+
77284+
<ol>
77285+
<li><p>If <var>candidate</var> is not an <code>Element</code> node, then
77286+
<span>continue</span>.</p></li>
7728377287

77284-
<li><p><span data-x="list iterate">For each</span> <var>candidate</var> of <var>candidates</var>,
77285-
<span data-x="concept-try-upgrade">try to upgrade</span> <var>candidate</var>.</p></li>
77288+
<li><p>If <var>candidate</var>'s <span data-x="element-custom-element-registry">custom element
77289+
registry</span> is not <span>this</span>, then <span>continue</span>.</p></li>
77290+
77291+
<li><p><span data-x="concept-try-upgrade">Try to upgrade</span> <var>candidate</var>.</p></li>
77292+
</ol>
7728677293
</ol>
7728777294
</div>
7728877295

@@ -77330,18 +77337,34 @@ console.assert(el instanceof SpiderMan); // upgraded!</code></pre>
7733077337
registry</span> to <span>this</span>.</p></li>
7733177338

7733277339
<li>
77333-
<p>For each <span>inclusive descendant</span> <var>inclusiveDescendant</var> of <var>root</var>:
77334-
if <var>inclusiveDescendant</var> is an <code>Element</code> node whose <span
77335-
data-x="element-custom-element-registry">custom element registry</span> is null:</p>
77340+
<p>For each <span>inclusive descendant</span> <var>inclusiveDescendant</var> of <var>root</var>,
77341+
in <span>tree order</span>:</p>
7733677342

7733777343
<ol>
77338-
<li><p>Set <var>inclusiveDescendant</var>'s <span
77339-
data-x="element-custom-element-registry">custom element registry</span> to
77340-
<span>this</span>.</p></li>
77344+
<li><p>If <var>inclusiveDescendant</var> is not an <code>Element</code> node, then
77345+
<span>continue</span>.</p></li>
77346+
77347+
<li>
77348+
<p>If <var>inclusiveDescendant</var>'s <span data-x="element-custom-element-registry">custom
77349+
element registry</span> is null:</p>
77350+
77351+
<ol>
77352+
<li><p>Set <var>inclusiveDescendant</var>'s <span
77353+
data-x="element-custom-element-registry">custom element registry</span> to
77354+
<span>this</span>.</p></li>
77355+
77356+
<li><p>If <span>this</span>'s <span>is scoped</span> is true, then <span data-x="set
77357+
append">append</span> <var>inclusiveDescendant</var>'s <span>node document</span> to
77358+
<span>this</span>'s <span>scoped document set</span>.</p></li>
77359+
</ol>
77360+
</li>
77361+
77362+
<li><p>If <var>inclusiveDescendant</var>'s <span
77363+
data-x="element-custom-element-registry">custom element registry</span> is not
77364+
<span>this</span>, then <span>continue</span>.</p></li>
7734177365

77342-
<li><p>If <span>this</span>'s <span>is scoped</span> is true, then <span data-x="set
77343-
append">append</span> <var>inclusiveDescendant</var>'s <span>node document</span> to
77344-
<span>this</span>'s <span>scoped document set</span>.</p></li>
77366+
<li><p><span data-x="concept-try-upgrade">Try to upgrade</span>
77367+
<var>inclusiveDescendant</var>.</p></li>
7734577368
</ol>
7734677369
</li>
7734777370
</ol>

0 commit comments

Comments
 (0)