From cc16d6c65954de365e4a19eeee3e714d6b4d2c9d Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Fri, 28 Nov 2025 09:10:17 +0100 Subject: [PATCH 1/2] Make DOMTokenList's supported token concept also depend on element It makes no sense for it to just depend on the attribute name. Also modernize this section while here. --- dom.bs | 103 +++++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 70 insertions(+), 33 deletions(-) diff --git a/dom.bs b/dom.bs index 20de2363..7c9e10de 100644 --- a/dom.bs +++ b/dom.bs @@ -10449,72 +10449,89 @@ interface DOMTokenList { token set (a set), which is initially empty. -

A {{DOMTokenList}} object also has an associated element and an attribute's -local name. +

A {{DOMTokenList}} object also has an associated element +(an element) and an attribute name (an attribute's +local name). Specifications may define supported tokens for a {{DOMTokenList}}'s -associated attribute's local name. +element and attribute name. -

A {{DOMTokenList}} object's +

+

A {{DOMTokenList}} object set's validation steps for a given token are:

    -
  1. If the associated attribute's local name does not define - supported tokens, throw a TypeError. +

  2. If set's element and + attribute name does not define supported tokens, then + throw a TypeError. -

  3. Let lowercase token be a copy of token, in ASCII lowercase. +

  4. Let lowercaseToken be token, in ASCII lowercase. -

  5. If lowercase token is present in supported tokens, return true. +

  6. If lowercaseToken is present in the supported tokens of + set's element and attribute name, then + return true.

  7. Return false.

+
-

A {{DOMTokenList}} object's update steps are: +

+

A {{DOMTokenList}} object set's +update steps are:

    -
  1. If the associated element does not have an associated attribute and - token set is empty, then return. +

  2. If get an attribute by namespace and local name given null, set's + attribute name, and set's element + returns null and set's token set is empty, then return. -

  3. Set an attribute value for the associated element using associated - attribute's local name and the result of running the ordered set - serializer for token set. +

  4. Set an attribute value given set's element, + set's attribute name, and the result of running the + ordered set serializer for set's token set.

+
-

A {{DOMTokenList}} object's serialize steps -are to return the result of running get an attribute value given the associated -element and the associated attribute's local name.

+
+

A {{DOMTokenList}} object set's +serialize steps are to return the result of +running get an attribute value given set's element and +set's attribute name. +


-

A {{DOMTokenList}} object has these attribute change steps for its associated -element: +

+

A {{DOMTokenList}} object set has these attribute change steps for +set's element:

    -
  1. If localName is associated attribute's local name, +

  2. If localName is set's attribute name, namespace is null, and value is null, then empty token set. -

  3. Otherwise, if localName is associated attribute's local name, - namespace is null, then set token set to value, - parsed. +

  4. Otherwise, if localName is set's + attribute name and namespace is null, then set set's + token set to value, parsed.

+
-

When a {{DOMTokenList}} object is created, then: +

+

When a {{DOMTokenList}} object set is created:

    -
  1. Let element be associated element. +

  2. Let element be set's element. -

  3. Let localName be associated attribute's local name. +

  4. Let attributeName be set's attribute name.

  5. Let value be the result of getting an attribute value given element and - localName. + attributeName. -

  6. Run the attribute change steps for element, localName, +

  7. Run the attribute change steps for element, attributeName, value, value, and null.

+
tokenlist . {{DOMTokenList/length}} @@ -10575,13 +10592,16 @@ are to return the result of running get an attribute value given the asso

Can be set, to change the associated attribute.

-

The length attribute' getter must return +

+

The length getter steps are to return this's token set's size. +

The object's supported property indices are the numbers in the range zero to object's token set's size − 1, unless token set is empty, in which case there are no supported property indices. +

The item(index) method steps are:

    @@ -10590,11 +10610,15 @@ in which case there are no supported property indices.
  1. Return this's token set[index].

+
+

The contains(token) method steps are to return true if this's token set[token] exists; otherwise false. +

+

The add(tokens…) method steps are: @@ -10616,7 +10640,9 @@ method steps are:

  • Run the update steps. +

  • +

    The remove(tokens…) method steps are: @@ -10638,7 +10664,9 @@ method steps are:

  • Run the update steps. +

  • +

    The toggle(token, force) method steps are: @@ -10665,10 +10693,12 @@ method steps are:

  • Return false. +

  • The update steps are not always run for {{DOMTokenList/toggle()}} for web compatibility. +

    The replace(token, newToken) method steps are: @@ -10691,10 +10721,12 @@ method steps are:

  • Return true. +

  • The update steps are not always run for {{DOMTokenList/replace()}} for web compatibility. +

    The supports(token) method steps are: @@ -10705,13 +10737,18 @@ method steps are:

  • Return result. +

  • -

    The value attribute must return the +

    +

    The value getter steps are to return the result of running this's serialize steps. +

    -

    Setting the {{DOMTokenList/value}} attribute must set an attribute value for the -associated element using associated attribute's local name and -the given value. +

    +

    The value setter steps are to +set an attribute value for this's element using this's +attribute name and the given value. +

    From d9dd565d7ea3558a298d260765f76f945a4c8052 Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Fri, 28 Nov 2025 09:30:56 +0100 Subject: [PATCH 2/2] Update dom.bs --- dom.bs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dom.bs b/dom.bs index 7c9e10de..1e9c5e9a 100644 --- a/dom.bs +++ b/dom.bs @@ -10501,7 +10501,7 @@ running get an attribute value given set's -
    +

    A {{DOMTokenList}} object set has these attribute change steps for set's element: @@ -10516,7 +10516,7 @@ running get an attribute value given set's

    -
    +

    When a {{DOMTokenList}} object set is created:

      @@ -10744,7 +10744,7 @@ method steps are: result of running this's serialize steps.
    -
    +

    The value setter steps are to set an attribute value for this's element using this's attribute name and the given value.