From 3e3a2be47670f520330708fb7cd30100888d780a Mon Sep 17 00:00:00 2001 From: David Baron Date: Thu, 16 Jul 2026 10:44:04 -0400 Subject: [PATCH] Define getters for "limited to only known values" attributes more formally. 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. --- source | 62 ++++++++++++++++++++++++++++++++++------------------------ 1 file changed, 36 insertions(+), 26 deletions(-) diff --git a/source b/source index 8dfc29a8f0b..737fef9a0c5 100644 --- a/source +++ b/source @@ -5430,31 +5430,34 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute

Multiple keywords can map to the same state.

-

To determine the state of an attribute, use the following steps:

+

To determine the state of an attribute given an attribute value value and + a set of keyword/state mappings and special states defined in the specification + attributeDefinition, use the following steps:

  1. -

    If the attribute is not specified:

    +

    If value is null (meaning the attribute is not specified):

      -
    1. If the attribute has a missing value default - state defined, then return that missing value default - state.

    2. +
    3. If attributeDefinition has a missing value + default state defined, then return that missing value + default state.

    4. Otherwise, return no state.

  2. -
  3. If the attribute's value is an ASCII case-insensitive match for one of the - keywords defined for the attribute, then return the state represented by that keyword.

  4. +
  5. If value is an ASCII case-insensitive match for one of the + keywords defined for the attribute in attributeDefinition, then return the state + represented by that keyword.

  6. -
  7. If the attribute has an empty value default state - defined and the attribute's value is the empty string, then return that empty value default state.

  8. +
  9. If attributeDefinition has an empty value + default state defined and value is the empty string, then return that empty value default state.

  10. -
  11. If the attribute has an invalid value default state - defined, then return that invalid value default - state.

  12. +
  13. If attributeDefinition has an invalid value + default state defined, then return that invalid value + default state.

  14. Return no state.

@@ -8679,14 +8682,17 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute values:

    -
  1. If contentAttributeValue does not correspond to any state of - attributeDefinition (e.g., it is null and there is no missing value default), or if it is in a state of - attributeDefinition with no associated keyword value, then return the empty - string.

  2. - -
  3. Return the canonical keyword for the state of - attributeDefinition that contentAttributeValue corresponds to.

  4. +
  5. Let attributeState be the result of determine the state of an + attribute given contentAttributeValue and + attributeDefinition.

  6. + +
  7. If attributeState is no state (e.g., because the attribute is not present + and there is no missing value default), or if + attributeState is a state of attributeDefinition with no associated + keyword value, then return the empty string.

  8. + +
  9. Return the canonical keyword for attributeState in + attributeDefinition.

@@ -8731,14 +8737,18 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
  • Assert: the reflected IDL attribute is limited to only known values.

  • -
  • Assert: contentAttributeValue corresponds to a state of +

  • Let attributeState be the result of determine the state of an + attribute given contentAttributeValue and attributeDefinition.

  • -
  • If contentAttributeValue corresponds to a state of - attributeDefinition with no associated keyword value, then return null.

  • +
  • If attributeState is no state, or if attributeState is a state + of attributeDefinition with no associated keyword value, then return + null.

  • + +
  • Assert: contentAttributeValue is not null.

  • -
  • Return the canonical keyword for the state of - attributeDefinition that contentAttributeValue corresponds to.

  • +
  • Return the canonical keyword for attributeState in + attributeDefinition.