Skip to content

Commit

Permalink
Give ElementInternals element-reflecting attributes more power
Browse files Browse the repository at this point in the history
In particular allow them to point to any known element, as long as that has the same shadow-including root as the ElementInternals's element. This is not considered to break encapsulation as ElementInternals itself is encapsulated.

Tests: anyone want to volunteer?

Fixes #8544.
  • Loading branch information
annevk committed Feb 22, 2023
1 parent b739da3 commit 35fad5b
Showing 1 changed file with 28 additions and 12 deletions.
40 changes: 28 additions & 12 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -8147,10 +8147,22 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
null:</p>

<ul>
<li><p>If <var>reflectedTarget</var>'s <span>explicitly set <var>attr</var>-element</span> is
a <span>descendant</span> of any of <var>element</var>'s <span
data-x="concept-shadow-including-ancestor">shadow-including ancestors</span>, then return
<var>reflectedTarget</var>'s <span>explicitly set <var>attr</var>-element</span>.</p></li>
<li>
<p>If one of the following is true:

<ul class="brief">
<li><var>reflectedTarget</var> is an <code>ElementInternals</code> object and
<var>reflectedTarget</var>'s <span>explicitly set <var>attr</var>-element</span>'s
<span>shadow-including root</span> is <var>element</var>'s <span>shadow-including
root</span></li>
<li><var>reflectedTarget</var>'s <span>explicitly set <var>attr</var>-element</span> is a
<span>descendant</span> of any of <var>element</var>'s <span
data-x="concept-shadow-including-ancestor">shadow-including ancestors</span></li>
</ul>

<p>then return <var>reflectedTarget</var>'s <span>explicitly set
<var>attr</var>-element</span>.</p>
</li>

<li><p>Return null.</p></li>
</ul>
Expand Down Expand Up @@ -8257,16 +8269,20 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
<ol>
<li>
<p><span data-x="list iterate">For each</span> <var>attrElement</var> in
<var>reflectedTarget</var>'s <span>explicitly set <var>attr</var>-elements</span>:</p>
<var>reflectedTarget</var>'s <span>explicitly set <var>attr</var>-elements</span>: if one of
the following is true:

<ol>
<li><p>If <var>attrElement</var> is not a <span>descendant</span> of any of
<var>element</var>'s <span data-x="concept-shadow-including-ancestor">shadow-including
ancestors</span>, then <span>continue</span>.</p></li>
<ul class="brief">
<li><var>reflectedTarget</var> is an <code>ElementInternals</code> object and
<var>attrElement</var>'s <span>shadow-including root</span> is <var>element</var>'s
<span>shadow-including root</span></li>

<li><p><span data-x="list append">Append</span> <var>attrElement</var> to
<var>elements</var>.</p></li>
</ol>
<li><var>attrElement</var> is a <span>descendant</span> of any of <var>element</var>'s
<span data-x="concept-shadow-including-ancestor">shadow-including ancestors</span></li>
</ul>

<p>then <span data-x="list append">append</span> <var>attrElement</var> to
<var>elements</var>.</p>
</li>
</ol>
</li>
Expand Down

0 comments on commit 35fad5b

Please sign in to comment.