Skip to content

Commit

Permalink
Use empty string for reflection of Element(s) IDL attributes
Browse files Browse the repository at this point in the history
Using the ID of the element led to surprising results in a number of edge cases.

Tests: web-platform-tests/wpt#36253.

Fixes #8306
  • Loading branch information
mrego authored Oct 7, 2022
1 parent 627ee28 commit 30c2607
Showing 1 changed file with 4 additions and 53 deletions.
57 changes: 4 additions & 53 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -7831,23 +7831,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
</ol>
</li>

<li><p>Let <var>id</var> be the empty string.</p></li>

<li>
<p>If the given value:</p>

<ul class="brief">
<li>has the same <span>root</span> as <span>this</span>, and</li>
<li>has an <code data-x="attr-id">id</code> attribute, and</li>
<li>is the first element in <span>this</span>'s <span>node tree</span> whose <span
data-x="concept-ID">ID</span> is the value of that <code data-x="attr-id">id</code>
attribute,</li>
</ul>

<p>then set <var>id</var> to the given value's <span data-x="concept-ID">ID</span>.</p>
</li>

<li><p>Set the content attribute's value for <span>this</span> to <var>id</var>.</p></li>
<li><p>Set the content attribute's value for <span>this</span> to the empty string.</p></li>

<li><p>Set <span>this</span>'s <span>explicitly set <var>attr</var>-element</span> to a weak
reference to the given value.</p></li>
Expand Down Expand Up @@ -7994,52 +7978,19 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
</ol>
</li>

<li><p>Let <var>value</var> be an empty string.</p></li>
<li><p>Set the content attribute's value for <span>this</span> to the empty string.</p></li>

<li><p>Let <var>elements</var> be an empty <span>list</span>.</p></li>

<li>
<p><span data-x="list iterate">For each</span> <var>element</var> in the given value:</p>

<ol>
<li>
<p>If <var>value</var> is empty and <var>elements</var> is non-empty, then:</p>

<ol>
<li><p><span data-x="list append">Append</span> a weak reference to <var>element</var>
to <var>elements</var>.</p></li>

<li><p><span>Continue</span>.</p></li>
</ol>
</li>

<li><p><span data-x="list append">Append</span> a weak reference to <var>element</var> to
<var>elements</var>.</p></li>

<li>
<p>If <var>element</var>:</p>

<ul class="brief">
<li>does not have the same <span>root</span> as <span>this</span>, or</li>
<li>has no <code data-x="attr-id">id</code> attribute, or</li>
<li>is not the first element in <span>this</span>'s <span>node tree</span> whose <span
data-x="concept-ID">ID</span> is the value of that <code data-x="attr-id">id</code>
attribute,</li>
</ul>

<p>then set <var>value</var> to the empty string, and <span>continue</span>.</p>
</li>

<li><p>Let <var>id</var> be <var>element</var>'s <span
data-x="concept-ID">ID</span>.</p></li>

<li><p>If <var>value</var> is not the empty string, then append U+0020 SPACE to
<var>value</var>.</p></li>

<li><p>Append <var>id</var> to <var>value</var>.</p></li>
</ol>
</li>

<li><p>Set the content attribute's value for <span>this</span> to <var>value</var>.</p></li>

<li><p>Set <span>this</span>'s <span>explicitly set <var>attr</var>-elements</span> to
<var>elements</var>.</p></li>
</ol>
Expand Down

0 comments on commit 30c2607

Please sign in to comment.