Skip to content

Commit

Permalink
review
Browse files Browse the repository at this point in the history
  • Loading branch information
annevk committed Feb 16, 2023
1 parent af2ab21 commit ab11d66
Showing 1 changed file with 121 additions and 116 deletions.
237 changes: 121 additions & 116 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -7587,31 +7587,28 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
<p>The building blocks for reflecting are as follows:</p>

<ul>
<li><p>A <dfn>reflected object</dfn> is an object. It is typically clear from context.</p></li>

<li><p>A <dfn>reflected target</dfn> is an element or <code>ElementInternals</code>
object. It is typically clear from context and typically identical to the <span>reflected
object</span>. It is always identical to the <span>reflected object</span> when it is an
object. It is typically clear from context and typically identical to the interface of the
<span>reflected IDL attribute</span>. It is always identical to that interface when it is an
<code>ElementInternals</code> object.</p></li>

<li><p>A <dfn>reflected IDL attribute</dfn> is a string representing the identifier of an
attribute interface member of the <span>reflected object</span>.</p></li>
<li><p>A <dfn>reflected IDL attribute</dfn> is an attribute interface member.</p></li>

<li><p>A <dfn>reflected content attribute</dfn> is a string. It represents the content attribute
local name of the <span>reflected target</span> when that is an element. When the <span>reflected
target</span> is an element the namespace of the respective content attribute has to be
null.</p></li>
</ul>

<p>A <span>reflected IDL attribute</span> of a <span>reflected object</span> can be defined to
<dfn>reflect</dfn> a <span>reflected content attribute</span> of a <span>reflected target</span>.
In general this means that the IDL attribute getter returns the current value of the content
attribute, and the setter changes the value of the content attribute to the given value.</p>
<p>A <span>reflected IDL attribute</span> can be defined to <dfn>reflect</dfn> a <span>reflected
content attribute</span> of a <span>reflected target</span>. In general this means that the IDL
attribute getter returns the current value of the content attribute, and the setter changes the
value of the content attribute to the given value.</p>

<p>If the <span>reflected target</span> is an element, then the <span>reflected IDL
attribute</span> can additionally declare to <dfn>support <code>ElementInternals</code></dfn>.
This means that the same <span>reflected IDL attribute</span> additionally <span
data-x="reflect">reflects</span> the same <span>reflected content attribute</span> on the
This means that the <span>reflected IDL attribute</span> with the same identifier <span
data-x="reflect">reflects</span> the <span>reflected content attribute</span> on the
<code>ElementInternals</code> object whose <span data-x="internals-target">target element</span>
is the same <span>reflected target</span>.</p>

Expand Down Expand Up @@ -7717,32 +7714,34 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
<p>The getter steps are:</p>

<ol>
<li><p>Let <var>element</var> be <span>this</span>'s <span>get the element</span>.</p></li>

<li><p>Let <var>contentAttributeValue</var> be <span>this</span>'s <span>get the content
attribute</span>.</p></li>

<li>
<p>If the attribute defined for the <span>reflected target</span>'s <span>get the
element</span>, with namespace null and local name <span>reflected content attribute</span>,
is an <span>enumerated attribute</span>, and the <span>reflected IDL attribute</span> of the
<span>reflected object</span> is <span>limited to only known values</span>:</p>
<!-- This is super awkward... -->
<p>If the attribute definition for <var>element</var>, with namespace null and local name
<span>reflected content attribute</span>, is an <span>enumerated attribute</span>, and the
<span>reflected IDL attribute</span> is defined to be <span>limited to only known
values</span>:</p>

<ol>
<li><p>If the <span>reflected target</span>'s <span>get the content attribute</span> is not
in any state (e.g., the return value is null and there is no <i data-x="missing value
default">missing value default</i>), or the content attribute is in a state with no
associated keyword value, then return the empty string.</p></li>
<!-- Less awkward, but still not great. -->

<li><p>Return the <span>canonical keyword</span> for the state of the <span>reflected
target</span>'s <span>get the content attribute</span>.</p></li>
<li><p>If <var>contentAttributeValue</var> indicates the attribute is not in any defined
state (e.g., it is null and there is no <i data-x="missing value default">missing value
default</i>), or that it is in a state with no associated keyword value, then return the
empty string.</p></li>

<li><p>Return the <span>canonical keyword</span> for the state of the attribute
<var>contentAttributeValue</var> indicates it is in.</p></li>
</ol>
</li>

<li><p>Return the <span>reflected target</span>'s <span>get the content
attribute</span>.</p></li>
<li><p>Return <var>contentAttributeValue</var>.</p></li>
</ol>
</li>

<li><p>The setter steps are to run the <span>reflected target</span>'s <span>set the content
attribute</span> with the given value.</p></li>
<li><p>The setter steps are to run <span>this</span>'s <span>set the content attribute</span>
with the given value.</p></li>
</ul>

<p>If a reflecting IDL attribute has the type <code data-x=""><span
Expand Down Expand Up @@ -7927,9 +7926,10 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute

<p>If a reflecting IDL attribute has the type <code>DOMTokenList</code>, then on getting it must
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. IDL attributes
of this type are not supported for <code>ElementInternals</code> objects.</p>
<!-- Supporting ElementInternals is doable, but would require corresponding changes to
whose associated attribute's local name is the name of the attribute in question. Specification
authors cannot use <span>support <code>ElementInternals</code></span> for IDL attributes of this
type.</p>
<!-- Supporting ElementInternals is doable in theory, but would require corresponding changes to
DOMTokenList. -->

<p>If a reflecting IDL attribute <var>attr</var> has the type <code
Expand All @@ -7948,8 +7948,11 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
<span>reflected target</span> <var>reflectedTarget</var>:</p>

<ol>
<li><p>Let <var>element</var> be <var>reflectedTarget</var> if it is an element; otherwise
<var>reflectedTarget</var>'s <span data-x="internals-target">target element</span>.</p></li>
<li><p>Let <var>element</var> be <var>reflectedTarget</var>'s <span>get the
element</span>.</p></li>

<li><p>Let <var>contentAttributeValue</var> be <var>reflectedTarget</var>'s <span>get the
content attribute</span>.</p></li>

<li>
<p>If <var>reflectedTarget</var>'s <span>explicitly set <var>attr</var>-element</span> is not
Expand All @@ -7966,15 +7969,14 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
</li>

<li>
<p>Otherwise, if the content attribute is present on <var>reflectedTarget</var>, return the
first element <var>candidate</var>, in <span>tree order</span>, that meets the following
criteria:</p>
<p>Otherwise, if <var>contentAttributeValue</var> is not null, return the first element
<var>candidate</var>, in <span>tree order</span>, that meets the following criteria:</p>

<ul class="brief">
<li><var>candidate</var>'s <span>root</span> is the same as <var>element</var>'s
<span>root</span>,</li>
<li><var>candidate</var>'s <span data-x="concept-ID">ID</span> is the value of the content
attribute, and</li>
<li><var>candidate</var>'s <span data-x="concept-ID">ID</span> is
<var>contentAttributeValue</var>, and</li>
<li><var>candidate</var> <span>implements</span> <var>T</var>.</li>
</ul>

Expand Down Expand Up @@ -8004,13 +8006,14 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
<li><p>Set <span>this</span>'s <span>explicitly set <var>attr</var>-element</span> to
null.</p></li>

<li><p>Remove the content attribute from <span>this</span>.</p></li>
<li><p>Run <span>this</span>'s <span>delete the content attribute</span>.</p></li>

<li><p>Return.</p></li>
</ol>
</li>

<li><p>Set the content attribute's value for <span>this</span> to the empty string.</p></li>
<li><p>Run <span>this</span>'s <span>set the content attribute</span> with 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 All @@ -8037,95 +8040,96 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
data-x="">FrozenArray&lt;<var>T</var>&gt;?</code>, where <var>T</var> is either
<code>Element</code> or an interface that inherits from <code>Element</code>, then:</p>

<!-- TODO: indentation here is wrong -->
<ul>
<li><p><span data-x="reflected target">Reflected targets</span> of the type this IDL attribute
appears on have <dfn>explicitly set <var>attr</var>-elements</dfn>, which is either a
<span>list</span> of weak references to elements or null. It is initially null.</p></li>
<ul>
<li><p><span data-x="reflected target">Reflected targets</span> of the type this IDL attribute
appears on have <dfn>explicitly set <var>attr</var>-elements</dfn>, which is either a
<span>list</span> of weak references to elements or null. It is initially null.</p></li>

<li><p><span data-x="reflected target">Reflected targets</span> of the type this IDL attribute
appears on have <dfn>cached <var>attr</var>-associated elements</dfn>, which is a <code
data-x="">FrozenArray&lt;<var>T</var>&gt;?</code>. It is initially null.</p></li>
<li><p><span data-x="reflected target">Reflected targets</span> of the type this IDL attribute
appears on have <dfn>cached <var>attr</var>-associated elements</dfn>, which is a <code
data-x="">FrozenArray&lt;<var>T</var>&gt;?</code>. It is initially null.</p></li>

<li>
<p><span data-x="reflected target">Reflected targets</span> of the type this IDL attribute
appears on have <dfn for="Element,ElementInternals" export><var>attr</var>-associated
elements</dfn>. To compute the <span><var>attr</var>-associated elements</span> for such a
<span>reflected target</span> <var>reflectedTarget</var>:</p>
<li>
<p><span data-x="reflected target">Reflected targets</span> of the type this IDL attribute
appears on have <dfn for="Element,ElementInternals" export><var>attr</var>-associated
elements</dfn>. To compute the <span><var>attr</var>-associated elements</span> for such a
<span>reflected target</span> <var>reflectedTarget</var>:</p>

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

<li><p>Let <var>element</var> be <var>reflectedTarget</var> if it is an element; otherwise
<var>reflectedTarget</var>'s <span data-x="internals-target">target element</span>.</p></li>
<li><p>Let <var>element</var> be <var>reflectedTarget</var>'s <span>get the
element</span>.</p></li>

<li>
<p>If <var>reflectedTarget</var>'s <span>explicitly set <var>attr</var>-elements</span> is not
null:</p>
<li>
<p>If <var>reflectedTarget</var>'s <span>explicitly set <var>attr</var>-elements</span> is not
null:</p>

<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>
<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>

<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>
<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>

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

<li>
<p>Otherwise:</p>
<ol>
<li><p>If the content attribute is not present on <var>reflectedTarget</var>, then return
null.</p></li>
<li>
<p>Otherwise:</p>

<li><p>Let <var>tokens</var> be the content attribute's value, <span data-x="split a string on
ASCII whitespace">split on ASCII whitespace</span>.
<ol>
<li><p>Let <var>contentAttributeValue</var> be <var>reflectedTarget</var>'s <span>get the
content attribute</span>.

<li>
<p><span data-x="list iterate">For each</span> <var>id</var> of <var>tokens</var>:</p>
<li><p>If <var>contentAttributeValue</var> is null, then return null.</p></li>

<ol>
<li>
<p>Let <var>candidate</var> be the first element, in <span>tree order</span>, that meets the
following criteria:</p>
<li><p>Let <var>tokens</var> be <var>contentAttributeValue</var>, <span data-x="split a
string on ASCII whitespace">split on ASCII whitespace</span>.

<ul class="brief">
<li><var>candidate</var>'s <span>root</span> is the same as <var>element</var>'s
<span>root</span>,</li>
<li><var>candidate</var>'s <span data-x="concept-ID">ID</span> is <var>id</var>, and</li>
<li><var>candidate</var> <span>implements</span> <var>T</var>.</li>
</ul>
<li>
<p><span data-x="list iterate">For each</span> <var>id</var> of <var>tokens</var>:</p>

<p>If no such element exists, then <span>continue</span>.</p>
</li>
<ol>
<li>
<p>Let <var>candidate</var> be the first element, in <span>tree order</span>, that meets
the following criteria:</p>

<li><p><span data-x="list append">Append</span> <var>candidate</var> to
<var>elements</var>.</p></li>
</ol>
</li>
</ol>
</li>
<ul class="brief">
<li><var>candidate</var>'s <span>root</span> is the same as <var>element</var>'s
<span>root</span>,</li>
<li><var>candidate</var>'s <span data-x="concept-ID">ID</span> is <var>id</var>, and</li>
<li><var>candidate</var> <span>implements</span> <var>T</var>.</li>
</ul>

<li><p>Return <var>elements</var>.</p></li>
</ol>
<p>If no such element exists, then <span>continue</span>.</p>
</li>

<p class="note">Other parts of this specification, or other specifications using attribute
reflection, are expected to consult a <span>reflected target</span>'s
<span><var>attr</var>-associated elements</span>. A <span>reflected target</span>'s
<span>explicitly set <var>attr</var>-elements</span> is an internal implementation detail of its
<span><var>attr</var>-associated elements</span> and is not to be used directly. Similarly, a
<span>reflected target</span>'s <span>cached <var>attr</var>-associated elements</span> is an
internal implementation detail of the IDL attribute's getter.</p>
</li>
<li><p><span data-x="list append">Append</span> <var>candidate</var> to
<var>elements</var>.</p></li>
</ol>
</li>
</ol>
</li>

<li><p>Return <var>elements</var>.</p></li>
</ol>

<p class="note">Other parts of this specification, or other specifications using attribute
reflection, are expected to consult a <span>reflected target</span>'s
<span><var>attr</var>-associated elements</span>. A <span>reflected target</span>'s
<span>explicitly set <var>attr</var>-elements</span> is an internal implementation detail of its
<span><var>attr</var>-associated elements</span> and is not to be used directly. Similarly, a
<span>reflected target</span>'s <span>cached <var>attr</var>-associated elements</span> is an
internal implementation detail of the IDL attribute's getter.</p>
</li>

<!-- TODO: indentation here is wrong -->
<li>
<p>The getter steps are:</p>

Expand Down Expand Up @@ -8161,13 +8165,14 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
<li><p>Set <span>this</span>'s <span>explicitly set <var>attr</var>-elements</span> to
null.</p></li>

<li><p>Remove the content attribute from <span>this</span>.</p></li>
<li><p>Run <span>this</span>'s <span>delete the content attribute</span>.</p></li>

<li><p>Return.</p></li>
</ol>
</li>

<li><p>Set the content attribute's value for <span>this</span> to the empty string.</p></li>
<li><p>Run <span>this</span>'s <span>set the content attribute</span> with the empty
string.</p></li>

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

Expand All @@ -8192,8 +8197,8 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
attribute and the IDL attribute:</p>

<ol>
<li><p>If <var>localName</var> is not the content attribute's local name, or
<var>namespace</var> is not null, then return.</p></li>
<li><p>If <var>localName</var> is not <var>element</var>'s <span>reflected content
attribute</span>, or <var>namespace</var> is not null, then return.</p></li>

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

0 comments on commit ab11d66

Please sign in to comment.