Editorial: Define getters for "limited to only known values" attributes more formally - #12692
Editorial: Define getters for "limited to only known values" attributes more formally#12692dbaron wants to merge 1 commit into
Conversation
…mally. This connects the definitions used by the DOMString and DOMString? IDL getters for enumerated attributes that are "limited to only known values" to the formal "determine the state of an attribute" definition that defines the state of an enumerated attribute. The old wording used vague "corresponds to" wording that seemed to imply a connection to this definition but that wasn't formally connected to it. Fixes whatwg#12688.
|
|
||
| <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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
I don't have a strong opinion here, but it seemed like we could allow specification authors the flexibility to not bother with the invalid value state if the intent is that it reflect as null. (I think this is a behavior change only in the sense that it allows specification authors to write spec text in ways that they couldn't before, not that it would change the implementation behavior of any previously-conformant spec text. At least that was my intent.)
|
|
||
| <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 |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
This appears to be the only occurrence of "the state of an attribute" in the spec (based on find-in-page on the single page version). So I think this should be ok.
| <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> |
There was a problem hiding this comment.
| <var>attributeDefinition</var>, use the following steps:</p> | |
| <var>attributeDefinition</var>:</p> |
Would be okay these days. For "To ..." we typically don't introduce the steps anymore.
| <ol> | ||
| <li> | ||
| <p>If the attribute is not specified:</p> | ||
| <p>If <var>value</var> is null (meaning the attribute is not specified):</p> |
There was a problem hiding this comment.
I don't think we need the parenthetical.
| 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> |
There was a problem hiding this comment.
We could drop Otherwise here since we use early returns.
|
|
||
| <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 |
There was a problem hiding this comment.
determining*
(you'll have to use data-x)
| 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 |
This connects the definitions used by the
DOMStringandDOMString?IDL getters for enumerated attributes that are "limited to only known values" to the formal "determine the state of an attribute" definition that defines the state of an enumerated attribute. The old wording used vague "corresponds to" wording that seemed to imply a connection to this definition but that wasn't formally connected to it.Fixes #12688.
cc @lukewarlow
/common-dom-interfaces.html ( diff )
/common-microsyntaxes.html ( diff )