Skip to content

Commit

Permalink
Update element and sequence<element> reflection sections
Browse files Browse the repository at this point in the history
  • Loading branch information
Alice Boxhall committed Jan 3, 2019
1 parent d5ffa81 commit 8a09ed4
Showing 1 changed file with 92 additions and 43 deletions.
135 changes: 92 additions & 43 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -7370,59 +7370,108 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
whose associated attribute's local name is the name of the attribute in question.</p>

<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>
or an interface that descends from <code>HTMLElement</code>, then:
<ul>
<li>On getting, it must run the following algorithm (stopping at the first point where a value is returned):
<ol>
<li>If a value for the IDL attribute was previously set via the setting algorithm (below),
then return that value, regardless of the value of the content attribute.

<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>Otherwise, if the content attribute is absent, then return null.</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>Otherwise, let <var>id</var> be the current value of the content attribute.

<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 <var>id</var> as its argument.</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 return null.</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, return <var>candidate</var>.</li>
</ol>
</li>
<li>On setting, it must run the following algorithm:
<ol>
<li>If the given value is null, remove the content attribute and stop.</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>Otherwise, let <var>id</var> be the empty string.</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>
<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>

<li>Set the content attribute to <var>id</var>.</li>
</ol>
</li>
<li>If the content attribute is set directly (such as via <code data-x="">Element.setAttribute()</code>),
the value for the IDL attribute is re-set to the value produced by the getting algorithm, above.</li>
</ul>

<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>
or <code data-x="">sequence&lt;<var>T</var>&gt;</code> where T descends from <code>Element</code>, then:
<ul>
<li>On getting, it must run the following algorithm (stopping at the first point where a value is returned):
<ol>
<li>If a value for the IDL attribute was previously set via the setting algorithm (below),
then it must return that value, regardless of the value of the content attribute.

<li>If the content attribute is absent, then the IDL attribute must return null.</li>

<li>Otherwise, let <var>elements</var> be an empty list.

<p>TODO</p>
<li>For each <var>id</var> in the <span>set of space-separated tokens</span>:
<ul>

<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 <var>id</var> as its argument.</li>

<li>If <var>candidate</var> is null, or if it is not type-compatible with the IDL attribute,
then continue to the next token.</li>

<li>Otherwise, append <var>candidate</var> to <var>elements</var>.</li>
</ul>

<li>Return <var>elements</var>.
</ol>
</li>
<li>On setting, it must run the following algorithm:
<ol>
<li>If the given value is null, remove the content attribute and stop.</li>

<li>Otherwise, let <var>value</var> be an empty string.</li>

<li>For each <var>element</var> in the sequence:
<ol>
<li>Let <var>id</var> be the empty string.</li>

<li>If the given element has no <code data-x="attr-id">id</code> attribute,
or is not in the same <span>tree</span> as the element of the attribute being set,
or the given element is not 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 continue to the next element in the sequence.

<li>Otherwise, let <var>id</var> be the value of the element's <code data-x="attr-id">id</code> attribute.

<li>If <var>value</var> is non-empty, append a space character to <var>value</var>.

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

<li>Set the content attribute to <var>value</var>.</li>
</ol>
</li>
<li>If the content attribute is set directly (such as via <code data-x="">Element.setAttribute()</code>),
the value for the IDL attribute is re-set to the value produced by the getting algorithm, above.</li>
</ul>

</div>

Expand Down

0 comments on commit 8a09ed4

Please sign in to comment.