Skip to content

Commit

Permalink
Add logic for reflecting IDREF (single) attributes.
Browse files Browse the repository at this point in the history
  • Loading branch information
Alice Boxhall committed Aug 9, 2018
1 parent 753e9fe commit 656b4a0
Showing 1 changed file with 55 additions and 1 deletion.
56 changes: 55 additions & 1 deletion source
Original file line number Diff line number Diff line change
Expand Up @@ -7309,8 +7309,62 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
return a <code>DOMTokenList</code> object whose associated element is the element in question and
whose associated attribute's local name is the name of the attribute in question.</p>

</div>
<p>If a reflecting IDL attribute has the type <code>HTMLElement</code>,
or an interface that descends from <code>HTMLElement</code>,
then it must be paired with another reflecting IDL attribute
that has the type <code data-x="idl-DOMString">DOMString</code>.
The relationship between these two attributes is as follows:</p>

<ol>
<li>The attribute which has the type <code>HTMLElement</code>
should be named <code data-x=""><var>attr</var>Element</code>,
where the paired <code data-x="idl-DOMString">DOMString</code> attribute is named
<code data-x=""><var>attr</var></code>.</li>

<li>On getting the <code data-x=""><var>attr</var></code> attribute,
the IDL attribute must return the value of the content attribute as normal.</li>

<li>On getting the <code data-x=""><var>attr</var>Element</code> attribute,
it must run the following algorithm
(stopping at the first point where a value is returned):</li>
<ol>
<li>If the content attribute corresponding to <code data-x=""><var>attr</var></code>
is absent, then the IDL attribute <code data-x=""><var>attr</var>Element</code> must return null.</li>

<li>Let <var>candidate</var> be the element that the
<code data-x="dom-Document-getElementById">document.getElementById()</code> method
would find when called on the content attribute's element's <span>node document</span>
if it were passed as its argument the current value
of the corresponding content attribute.</li>

<li>If <var>candidate</var> is null, or if it is not type-compatible with the IDL attribute,
then the IDL attribute must return null.</li>

<li>Otherwise, it must return <var>candidate</var>.</li>
</ol>
<li>On setting the <code data-x=""><var>attr</var></code> attribute,
the content attribute must be set to the specified value.</li>

<li>On setting the <code data-x=""><var>attr</var>Element</code> attribute,
it must run the following algorithm:</li>
<ol>
<li>Let <var>id</var> be the empty string.</li>
<li>If the given element has an <code data-x="attr-id">id</code> attribute,
and has the same <span>tree</span> as the element of the attribute being set,
and the given element is the first element in that <span>tree</span>
whose <span data-x="concept-ID">ID</span> is the value
of that <code data-x="attr-id">id</code> attribute,
then let <var>id</var> be the value of that <code data-x="attr-id">id</code> attribute.
<li>Set the <code data-x=""><var>attr</var></code> content attribute to <var>id</var>.
</ol>
</ol>

<p>If a reflecting IDL attribute has the type <code data-x="">sequence&lt;Element&gt;</code>,
or <code data-x="">sequence&lt;<var>T</var>&gt;</code> where T descends from <code>Element</code>...</p>

<p>TODO</p>

</div>

<h4>Collections</h4>

Expand Down

0 comments on commit 656b4a0

Please sign in to comment.