Skip to content

Editorial: Define getters for "limited to only known values" attributes more formally#12692

Open
dbaron wants to merge 1 commit into
whatwg:mainfrom
dbaron:improve-attribute-reflection
Open

Editorial: Define getters for "limited to only known values" attributes more formally#12692
dbaron wants to merge 1 commit into
whatwg:mainfrom
dbaron:improve-attribute-reflection

Conversation

@dbaron

@dbaron dbaron commented Jul 16, 2026

Copy link
Copy Markdown
Member

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 #12688.

cc @lukewarlow


/common-dom-interfaces.html ( diff )
/common-microsyntaxes.html ( diff )

…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.
Comment thread source

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

Comment thread source

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

reflection of enumerated attributes doesn't seem to process empty/missing/invalid value defaults clearly

2 participants