-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Editorial: Define getters for "limited to only known values" attributes more formally #12692
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 | ||
| 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> | ||
|
|
@@ -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> | ||
|
|
||
|
|
@@ -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 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the 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> | ||
|
|
||
|
|
||
There was a problem hiding this comment.
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)