Skip to content

Commit

Permalink
Set empty string for reflection of IDREF attributes
Browse files Browse the repository at this point in the history
To avoid issues with wrong IDs in IDREF attributes
we set the content attribute's value to the empty string
in the setter steps for Element and FrozenArray<Element>.

Fixes whatwg#8306
  • Loading branch information
mrego committed Oct 5, 2022
1 parent fce6d85 commit d28581c
Showing 1 changed file with 2 additions and 53 deletions.
55 changes: 2 additions & 53 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -7789,23 +7789,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 @@ -7952,51 +7936,16 @@ 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><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 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>-elements</span> to
<var>elements</var>.</p></li>
Expand Down

0 comments on commit d28581c

Please sign in to comment.