Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 36 additions & 26 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -5430,31 +5430,34 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
<p class="note">Multiple keywords can map to the same state.</p>

<div algorithm>
<p>To determine the state of an attribute, use the following steps:</p>
<p>To <dfn>determine the state of an attribute</dfn> given an attribute value <var>value</var> and

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As this now takes an extra argument I would just double check that this algorithm wasn't somehow being used without the linking existing anywhere other than the reflection algorithms that've you touched. (I don't think it is but worth double checking)

a set of keyword/state mappings and special states defined in the specification
<var>attributeDefinition</var>, use the following steps:</p>

<ol>
<li>
<p>If the attribute is not specified:</p>
<p>If <var>value</var> is null (meaning the attribute is not specified):</p>

<ol>
<li><p>If the attribute has a <i data-x="missing value default">missing value default</i>
state defined, then return that <i data-x="missing value default">missing value default</i>
state.</p></li>
<li><p>If <var>attributeDefinition</var> has a <i data-x="missing value default">missing value
default</i> state defined, then return that <i data-x="missing value default">missing value
default</i> state.</p></li>

<li><p>Otherwise, return no state.</p></li>
</ol>
</li>

<li><p>If the attribute's value is an <span>ASCII case-insensitive</span> match for one of the
keywords defined for the attribute, then return the state represented by that keyword.</p></li>
<li><p>If <var>value</var> is an <span>ASCII case-insensitive</span> match for one of the
keywords defined for the attribute in <var>attributeDefinition</var>, then return the state
represented by that keyword.</p></li>

<li><p>If the attribute has an <i data-x="empty value default">empty value default</i> state
defined and the attribute's value is the empty string, then return that <i data-x="empty value
default">empty value default</i> state.</p></li>
<li><p>If <var>attributeDefinition</var> has an <i data-x="empty value default">empty value
default</i> state defined and <var>value</var> is the empty string, then return that <i
data-x="empty value default">empty value default</i> state.</p></li>

<li><p>If the attribute has an <i data-x="invalid value default">invalid value default</i> state
defined, then return that <i data-x="invalid value default">invalid value default</i>
state.</p></li>
<li><p>If <var>attributeDefinition</var> has an <i data-x="invalid value default">invalid value
default</i> state defined, then return that <i data-x="invalid value default">invalid value
default</i> state.</p></li>

<li><p>Return no state.</p></li>
</ol>
Expand Down Expand Up @@ -8679,14 +8682,17 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
values</span>:</p>

<ol>
<li><p>If <var>contentAttributeValue</var> does not correspond to any state of
<var>attributeDefinition</var> (e.g., it is null and there is no <i data-x="missing value
default">missing value default</i>), or if it is in a state of
<var>attributeDefinition</var> with no associated keyword value, then return the empty
string.</p></li>

<li><p>Return the <span>canonical keyword</span> for the state of
<var>attributeDefinition</var> that <var>contentAttributeValue</var> corresponds to.</p></li>
<li><p>Let <var>attributeState</var> be the result of <span>determine the state of an
attribute</span> given <var>contentAttributeValue</var> and
<var>attributeDefinition</var>.</p></li>

<li><p>If <var>attributeState</var> is no state (e.g., because the attribute is not present
and there is no <i data-x="missing value default">missing value default</i>), or if
<var>attributeState</var> is a state of <var>attributeDefinition</var> with no associated
keyword value, then return the empty string.</p></li>

<li><p>Return the <span>canonical keyword</span> for <var>attributeState</var> in
<var>attributeDefinition</var>.</p></li>
</ol>
</li>

Expand Down Expand Up @@ -8731,14 +8737,18 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
<li><p><span>Assert</span>: the <span>reflected IDL attribute</span> is <span>limited to only
known values</span>.</p></li>

<li><p><span>Assert</span>: <var>contentAttributeValue</var> corresponds to a state of
<li><p>Let <var>attributeState</var> be the result of <span>determine the state of an
attribute</span> given <var>contentAttributeValue</var> and
<var>attributeDefinition</var>.</p></li>

<li><p>If <var>contentAttributeValue</var> corresponds to a state of
<var>attributeDefinition</var> with no associated keyword value, then return null.</p></li>
<li><p>If <var>attributeState</var> is no state, or if <var>attributeState</var> is a state

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the no state part of the condition here is actually a behaviour change in so far as we're not asserting that it matches a state.

Editorially, we require attribute definitions in this scenario has an an invalid value state. Whereas in now we're allowing them not to have one?

of <var>attributeDefinition</var> with no associated keyword value, then return
null.</p></li>

<li><p><span>Assert</span>: <var>contentAttributeValue</var> is not null.</p></li>

<li><p>Return the <span>canonical keyword</span> for the state of
<var>attributeDefinition</var> that <var>contentAttributeValue</var> corresponds to.</p></li>
<li><p>Return the <span>canonical keyword</span> for <var>attributeState</var> in
<var>attributeDefinition</var>.</p></li>
</ol>
</li>

Expand Down
Loading