From b739da31a01923876f18c863954853d60acf56ff Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Wed, 22 Feb 2023 11:39:39 +0100 Subject: [PATCH] Make reflect work for ElementInternals Other changes: * Remove reflection of unrestricted double as it is buggy and unused. * The DOMString getter steps did not account for a missing attribute. * The native accessibility semantics map was renamed to the internal content attribute map as it's now a more general reflection concept. Corresponding ARIA PR: https://github.com/w3c/aria/pull/1876. Fixes #8442. Follow-up: * https://github.com/w3c/core-aam/issues/152 * https://github.com/w3c/aria/issues/1110 * #3238 * #8544 * #8545 * #8926 * #8927 * #8928 * #8930 --- source | 830 +++++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 542 insertions(+), 288 deletions(-) diff --git a/source b/source index 9af19db6dcc..120c2e3ee7b 100644 --- a/source +++ b/source @@ -3126,8 +3126,9 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute removing steps, adopting steps, and children changed steps hooks for elements -
  • The change, append, remove, replace, and set value algorithms for attributes
  • +
  • The change, append, remove, replace, get an attribute by namespace and local name, set value, and remove an attribute by namespace and local name algorithms for attributes
  • The attribute change steps hook for attributes
  • +
  • The value concept for attributes
  • The attribute list concept
  • The data of a CharacterData node and its replace data algorithm
  • @@ -7624,57 +7625,175 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute

    Reflecting content attributes in IDL attributes

    -

    Some IDL attributes are defined to reflect a particular content attribute. This - means that on getting, the IDL attribute returns the current value of the content attribute, and - on setting, the IDL attribute changes the value of the content attribute to the given value.

    +

    The building blocks for reflecting are as follows:

    + + + +

    A reflected IDL attribute can be defined to reflect a reflected + content attribute name of a reflected target. In general this means that the + IDL attribute getter returns the current value of the content attribute, and the setter changes + the value of the content attribute to the given value.

    + +

    If the reflected target is an element, then the reflected IDL + attribute can additionally declare to support ElementInternals. + This means that the ElementInternals interface also has a reflected IDL + attribute, with the same identifier, and that reflected IDL attribute reflects the same reflected content attribute name.

    + +

    The fooBar + IDL attribute must reflect the foobar content attribute and support + ElementInternals.

    -

    In general, on getting, if the content attribute is not present, the IDL attribute must act as - if the content attribute's value is the empty string; and on setting, if the content attribute is - not present, it must first be added.

    +

    Reflected targets have these associated algorithms: + +

    + +

    For a reflected target that is an element element, these are defined as + follows:

    + +
    +
    get the element
    +
    1. Return element.

    + +
    get the content attribute
    +
    +
      +
    1. Let attribute be the result of running get an attribute by namespace and local + name given null, the reflected content attribute name, and + element.

    2. + +
    3. If attribute is null, then return null.

    4. + +
    5. Return attribute's value.

    6. +
    +
    + +
    set the content attribute with a string value
    +
    1. Set an attribute value + given element, the reflected content attribute name, and + value.

    + +
    delete the content attribute
    +
    1. Remove an attribute + by namespace and local name given null, the reflected content attribute name, + and element.

    +
    + +

    For a reflected target that is an ElementInternals object + elementInternals, they are defined as follows:

    + +
    +
    get the element
    +
    1. Return elementInternals's target + element.

    + +
    get the content attribute
    +
    +
      +
    1. If elementInternals's target element's + internal content attribute map[the reflected content attribute name] + does not exist, then return null. + +

    2. Return elementInternals's target + element's internal content attribute map[the reflected content + attribute name].

    3. +
    +
    + +
    set the content attribute with a string value
    +
    1. Set elementInternals's target element's internal content attribute map[the + reflected content attribute name] to value.

    + +
    delete the content attribute
    +
    1. Remove elementInternals's target element's internal content attribute map[the + reflected content attribute name].

    +
    + +

    This results in somewhat redundant data structures for + ElementInternals objects as their target + element's internal content attribute map cannot be directly manipulated and as + such reflection is only happening in a single direction. This approach was nevertheless chosen to + make it less error-prone to define IDL attributes that are shared between reflected targets and benefit from common API semantics.

    + +

    IDL attributes of type DOMString or DOMString? that reflect DOMString? that reflect enumerated content attributes can be limited to only known values. Per the processing models below, those will cause the getters for such IDL attributes to only return keywords for those enumerated attributes, or the empty string or null.

    -

    If a reflecting IDL attribute has the type DOMString:

    +

    If a reflected IDL attribute has the type DOMString:

    -

    If a reflecting IDL attribute has the type If a reflected IDL attribute has the type DOMString?:

      @@ -7682,19 +7801,30 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute

      The getter steps are:

        -
      1. Assert: the content attribute is an enumerated +

      2. Let element be the result of running this's get the + element.

      3. + +
      4. Let contentAttributeValue be the result of running this's + get the content attribute.

      5. + +
      6. Let attributeDefinition be the attribute definition of element's + content attribute whose namespace is null and local name is the reflected content + attribute name. + +

      7. Assert: attributeDefinition indicates it is an enumerated attribute.

      8. -
      9. Assert: the IDL attribute is limited to only known - values.

      10. +
      11. Assert: the reflected IDL attribute is limited to only + known values.

      12. -
      13. Assert: the content attribute is in some state.

      14. +
      15. Assert: contentAttributeValue corresponds to a state of + attributeDefinition.

      16. -
      17. If the content attribute is in a state with no associated keyword value, then return - null.

      18. +
      19. If contentAttributeValue corresponds to a state of + attributeDefinition with no associated keyword value, then return null.

      20. -
      21. Return the canonical keyword for the state of the content - attribute.

      22. +
      23. Return the canonical keyword for the state of + attributeDefinition that contentAttributeValue corresponds to.

      @@ -7702,198 +7832,339 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute

      The setter steps are:

        -
      1. If the given value is null, then remove the content attribute.

      2. +
      3. If the given value is null, then run this's delete the content + attribute.

      4. -
      5. Otherwise, set the content attribute's value to the given value.

      6. +
      7. Otherwise, run this's set the content attribute with the given + value.

    -

    If a reflecting IDL attribute has the type USVString:

    +

    If a reflected IDL attribute has the type USVString:

    • The getter steps are:

        +
      1. Let element be the result of running this's get the + element.

      2. + +
      3. Let contentAttributeValue be the result of running this's + get the content attribute.

      4. + +
      5. Let attributeDefinition be the attribute definition of element's + content attribute whose namespace is null and local name is the reflected content + attribute name. +

      6. -

        If the content attribute is defined to contain a URL:

        +

        If attributeDefinition indicates it contains a URL:

          -
        1. If the content attribute is absent, then return the empty string.

        2. - -
        3. Parse the value of the content attribute relative - to the element's node document.

        4. +
        5. If contentAttributeValue is null, then return the empty string.

        6. -
        7. If that is successful, then return the resulting URL string.

        8. +
        9. Parse contentAttributeValue relative to + the element's node document.

        10. -
        11. Otherwise, return the value of the content attribute, converted to a USVString.

        12. +
        13. If that does not return failure, then return the resulting URL + string.

      7. +
      8. Return contentAttributeValue, converted to a scalar value string.

      9. +
      +
    • + +
    • The setter steps are to run this's set the content attribute + with the given value.

    • +
    + +

    If a reflected IDL attribute has the type boolean:

    + +
      +
    • +

      The getter steps are:

      + +
        +
      1. Let contentAttributeValue be the result of running this's + get the content attribute.

      2. + +
      3. If contentAttributeValue is null, then return false.

      4. + +
      5. Return true.

      6. +
      +
    • + +
    • +

      The setter steps are:

      + +
        +
      1. If the given value is false, then run this's delete the content + attribute.

      2. + +
      3. If the given value is true, then run this's set the content + attribute with the empty string. +

      +
    • +
    + +

    This corresponds to the rules for boolean content + attributes. + +

    If a reflected IDL attribute has the type long, + optionally limited to only non-negative numbers: + +

      +
    • +

      The getter steps are:

      + +
        +
      1. Let contentAttributeValue be the result of running this's + get the content attribute.

      2. +
      3. -

        Otherwise:

        +

        If contentAttributeValue is not null:

          -
        1. Return the value of the content attribute, converted to a USVString.

        2. +
        3. Let parsedValue be the result of integer parsing contentAttributeValue if the reflected IDL + attribute is not limited to only non-negative numbers; otherwise the + result of non-negative integer + parsing contentAttributeValue.

        4. + +
        5. If parsedValue is not an error and is within the long range, then return parsedValue.

        +
      4. + +
      5. If the reflected IDL attribute has a default value, then return + it.

      6. + +
      7. If the reflected IDL attribute is limited to only non-negative + numbers, then return −1.

      8. + +
      9. Return 0.

    • -
    • The setter steps are to set the content attribute's value to the given value.

    • +
    • +

      The setter steps are:

      + +
        +
      1. If the reflected IDL attribute is limited to only non-negative + numbers and the given value is negative, then throw an + "IndexSizeError" DOMException.

      2. + +
      3. Run this's set the content attribute with the given value + converted to the shortest possible string representing the number as a valid + integer.

      4. +
      +
    -

    If a reflecting IDL attribute is a boolean attribute, then on - getting the IDL attribute must return true if the content attribute is set, and false if it is - absent. On setting, the content attribute must be removed if the IDL attribute is set to false, - and must be set to the empty string if the IDL attribute is set to true. (This corresponds to the - rules for boolean content attributes.)

    - -

    If a reflecting IDL attribute has a signed integer type (long) - then, on getting, the content attribute must be parsed according to the rules for parsing signed integers, and if that is successful, and the - value is in the range of the IDL attribute's type, the resulting value must be returned. If, on - the other hand, it fails or returns an out of range value, or if the attribute is absent, then the - default value must be returned instead, or 0 if there is no default value. On setting, the given - value must be converted to the shortest possible string representing the number as a valid - integer and then that string must be used as the new content attribute value.

    - -

    If a reflecting IDL attribute has a signed integer type (long) - that is limited to only non-negative numbers then, on getting, the content attribute - must be parsed according to the rules for parsing non-negative integers, and if that - is successful, and the value is in the range of the IDL attribute's type, the resulting value must - be returned. If, on the other hand, it fails or returns an out of range value, or if the attribute - is absent, the default value must be returned instead, or −1 if there is no default value. - On setting, if the value is negative, the user agent must throw an - "IndexSizeError" DOMException. Otherwise, the given value - must be converted to the shortest possible string representing the number as a valid - non-negative integer and then that string must be used as the new content attribute - value.

    +

    If a reflected IDL attribute has the type unsigned long, optionally limited to only non-negative + numbers greater than zero, limited to only non-negative numbers greater than zero with + fallback, or clamped to the range [clampedMin, clampedMax]: -

    If a reflecting IDL attribute has an unsigned integer type (unsigned long) then, on getting, the content attribute must be - parsed according to the rules for parsing non-negative integers, and if that is - successful, and the value is in the range 0 to 2147483647 inclusive, the resulting value must be - returned. If, on the other hand, it fails or returns an out of range value, or if the attribute is - absent, the default value must be returned instead, or 0 if there is no default value. On setting, - first, if the new value is in the range 0 to 2147483647, then let n be the new value, - otherwise let n be the default value, or 0 if there is no default value; then, - n must be converted to the shortest possible string representing the number as a - valid non-negative integer and that string must be used as the new content attribute - value.

    +
      +
    • +

      The getter steps are:

      + +
        +
      1. Let contentAttributeValue be the result of running this's + get the content attribute.

      2. + +
      3. Let minimum be 0.

      4. + +
      5. If the reflected IDL attribute is limited to only non-negative + numbers greater than zero or limited to only non-negative numbers greater than + zero with fallback, then set minimum to 1.

      6. + +
      7. If the reflected IDL attribute is clamped to the range, then + set minimum to clampedMin.

      8. + +
      9. Let maximum be 2147483647 if the reflected IDL attribute is not + clamped to the range; otherwise clampedMax.

      10. + +
      11. +

        If contentAttributeValue is not null: + +

          +
        1. Let parsedValue be the result of non-negative integer parsing + contentAttributeValue.

        2. + +
        3. If parsedValue is not an error and is in the range minimum to + maximum, inclusive, then return parsedValue.

        4. + +
        5. +

          If parsedValue is not an error and the reflected IDL attribute is + clamped to the range: + +

            +
          1. If parsedValue is less than minimum, then return + minimum.

          2. + +
          3. Return maximum.

          4. +
          +
        6. +
        +
      12. + +
      13. If the reflected IDL attribute has a default value, then return + it.

      14. + +
      15. Return minimum.

      16. +
      +
    • + +
    • +

      The setter steps are:

      + +
        +
      1. If the reflected IDL attribute is limited to only non-negative + numbers greater than zero and the given value is 0, then throw an + "IndexSizeError" DOMException.

      2. + +
      3. Let minimum be 0.

      4. + +
      5. If the reflected IDL attribute is limited to only non-negative + numbers greater than zero or limited to only non-negative numbers greater than + zero with fallback, then set minimum to 1.

      6. + +
      7. Let newValue be minimum.

      8. + +
      9. If the reflected IDL attribute has a default value, then set + newValue to it.

      10. + +
      11. If the given value is in the range minimum to 2147483647, inclusive, + then set newValue to it.

      12. + +
      13. Run this's set the content attribute with newValue + converted to the shortest possible string representing the number as a valid non-negative + integer.

      14. +
      + +

      Clamped to the range has no effect on the setter steps.

      +
    • +
    -

    If a reflecting IDL attribute has an unsigned integer type (unsigned long) that is limited to only non-negative numbers - greater than zero, then the behavior is similar to the previous case, but zero is not - allowed. On getting, the content attribute must first be parsed according to the rules for - parsing non-negative integers, and if that is successful, and the value is in the range 1 - to 2147483647 inclusive, the resulting value must be returned. If, on the other hand, it fails or - returns an out of range value, or if the attribute is absent, the default value must be returned - instead, or 1 if there is no default value. On setting, if the value is zero, the user agent must - throw an "IndexSizeError" DOMException. Otherwise, first, - if the new value is in the range 1 to 2147483647, then let n be the new value, - otherwise let n be the default value, or 1 if there is no default value; then, - n must be converted to the shortest possible string representing the number as a - valid non-negative integer and that string must be used as the new content attribute - value.

    - -

    If a reflecting IDL attribute has an unsigned integer type (unsigned long) that is limited to only non-negative numbers - greater than zero with fallback, then the behavior is similar to the previous case, but - disallowed values are converted to the default value. On getting, the content attribute must first - be parsed according to the rules for parsing non-negative integers, and if that is - successful, and the value is in the range 1 to 2147483647 inclusive, the resulting value must be - returned. If, on the other hand, it fails or returns an out of range value, or if the attribute is - absent, the default value must be returned instead. On setting, first, if the new value is in the - range 1 to 2147483647, then let n be the new value, otherwise let n be the - default value; then, n must be converted to the shortest possible string representing - the number as a valid non-negative integer and that string must be used as the new - content attribute value.

    - -

    If a reflecting IDL attribute has an unsigned integer type (unsigned long) that is clamped to the range - [min, max], then on getting, the content attribute must first be parsed - according to the rules for parsing non-negative integers, and if that is successful, - and the value is between min and max inclusive, the resulting value must be - returned. If it fails, the default value must be returned. If it succeeds but the value is less - than min, min must be returned. If it succeeds but the value is greater than - max, max must be returned. On setting, it behaves the same as setting a - regular reflected unsigned integer.

    - -

    If a reflecting IDL attribute has a floating-point number type (double or unrestricted - double), then, on getting, the content attribute must be parsed according to the - rules for parsing floating-point number values, and if that is successful, the - resulting value must be returned. If, on the other hand, it fails, or if the attribute is absent, - the default value must be returned instead, or 0.0 if there is no default value. On setting, the - given value must be converted to the best representation of the number as a floating-point - number and then that string must be used as the new content attribute value.

    - -

    If a reflecting IDL attribute has a floating-point number type (double or unrestricted - double) that is limited to numbers greater than zero, then the behavior is - similar to the previous case, but zero and negative values are not allowed. On getting, the - content attribute must be parsed according to the rules for parsing floating-point number - values, and if that is successful and the value is greater than 0.0, the resulting value - must be returned. If, on the other hand, it fails or returns an out of range value, or if the - attribute is absent, the default value must be returned instead, or 0.0 if there is no default - value. On setting, if the value is less than or equal to zero, then the value must be ignored. - Otherwise, the given value must be converted to the best representation of the number as a - floating-point number and then that string must be used as the new content attribute - value.

    +

    If a reflected IDL attribute has the type double, + optionally limited to numbers greater than zero: + +

      +
    • +

      The getter steps are:

      + +
        +
      1. Let contentAttributeValue be the result of running this's + get the content attribute.

      2. + +
      3. +

        If contentAttributeValue is not null: + +

          +
        1. Let parsedValue be the result of floating-point number parsing + contentAttributeValue.

        2. + +
        3. If parsedValue is not an error and is greater than 0, then return + parsedValue.

        4. + +
        5. If parsedValue is not an error and the reflected IDL attribute + is not limited to numbers greater than zero, then return + parsedValue.

        6. +
        +
      4. + +
      5. If the reflected IDL attribute has a default value, then return + it.

      6. + +
      7. Return 0.

      8. +
      +
    • + + +
    • +

      The setter steps are:

      + +
        +
      1. If the reflected IDL attribute is limited to numbers greater than + zero and the given value is not greater than 0, then return.

      2. + +
      3. Run this's set the content attribute with the given value, + converted to the best representation of the number as a floating-point + number.

      4. +
      +
    • +

    The values Infinity and Not-a-Number (NaN) values throw an exception on setting, as defined in Web IDL.

    -

    If a reflecting IDL attribute has the type DOMTokenList, then on getting it must - return a DOMTokenList object whose associated element is the element in question and - whose associated attribute's local name is the name of the attribute in question.

    +

    If a reflected IDL attribute has the type DOMTokenList, then its + getter steps are to return a DOMTokenList object whose associated element is + this and associated attribute's local name is the reflected content + attribute name. Specification authors cannot use support + ElementInternals for IDL attributes of this type.

    + -

    If a reflecting IDL attribute attr has the type If a reflected IDL attribute attr has the type T?, where T is either Element or an interface that inherits from Element, then:

      -
    • Elements of the type this IDL attribute appears on have an explicitly set - attr-element, which is a weak reference to an element or null. It is initially - null.

    • +
    • Reflected targets that attr appears on + have an explicitly set attr-element, which is a weak reference to an + element or null. It is initially null.

    • -

      Elements of the type this IDL attribute appears on have an attr-associated element. To compute the attr-associated - element for such an element element:

      +

      Reflected targets that attr appears on have + an attr-associated element. To + compute the attr-associated element for such a reflected + target reflectedTarget:

        +
      1. Let element be the result of running reflectedTarget's get + the element.

      2. + +
      3. Let contentAttributeValue be the result of running + reflectedTarget's get the content attribute.

      4. +
      5. -

        If element's explicitly set attr-element is not null:

        +

        If reflectedTarget's explicitly set attr-element is not + null:

        +
          -
        • If element's explicitly set attr-element is a - descendant of any of element's

          If reflectedTarget's explicitly set attr-element is + a descendant of any of element's shadow-including ancestors, then return - element's explicitly set attr-element.

        • -
        • Otherwise, return null.

        • + reflectedTarget's explicitly set attr-element.

          + +
        • Return null.

      6. -

        Otherwise, if the content attribute is present on element, then return the first - element candidate, in tree order, that meets the following - criteria:

        +

        Otherwise, if contentAttributeValue is not null, return the first element + candidate, in tree order, that meets the following criteria:

        • candidate's root is the same as element's root,
        • -
        • candidate's ID is the value of the content - attribute, and
        • +
        • candidate's ID is + contentAttributeValue, and
        • candidate implements T.
        @@ -7904,10 +8175,10 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute

      Other parts of this specification, or other specifications using attribute - reflection, are expected to consult an element's attr-associated - element. An element's explicitly set attr-element is an internal - implementation detail of its attr-associated element and is not to be - used directly.

      + reflection, are expected to consult a reflected target's + attr-associated element. A reflected target's + explicitly set attr-element is an internal implementation detail of its + attr-associated element and is not to be used directly.

    • The getter steps are to return this's attr-associated @@ -7923,13 +8194,14 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute

    • Set this's explicitly set attr-element to null.

    • -
    • Remove the content attribute from this.

    • +
    • Run this's delete the content attribute.

    • Return.

    • -
    • Set the content attribute's value for this to the empty string.

    • +
    • Run this's set the content attribute with the empty + string.

    • Set this's explicitly set attr-element to a weak reference to the given value.

    • @@ -7937,12 +8209,14 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
    • -

      The following attribute change - steps, given element, localName, oldValue, - value, and namespace, are used to synchronize between the content - attribute and the IDL attribute:

      +

      For element reflected targets only: the following + attribute change steps, given + element, localName, oldValue, value, and + namespace, are used to synchronize between the content attribute and the IDL + attribute:

      +
        -
      1. If localName is not the content attribute's local name, or +

      2. If localName is not the reflected content attribute name or namespace is not null, then return.

      3. Set element's explicitly set attr-element to @@ -7951,89 +8225,100 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute

    -

    If a reflecting IDL attribute attr has the type If a reflected IDL attribute attr has the type FrozenArray<T>?, where T is either Element or an interface that inherits from Element, then:

    -
      -
    • Elements of the type this IDL attribute appears on have explicitly set - attr-elements, which is either a list of weak references to elements - or null. It is initially null.

    • +
        +
      • Reflected targets that attr appears on + have explicitly set attr-elements, which is either a list of + weak references to elements or null. It is initially null.

      • -
      • Elements of the type this IDL attribute appears on have cached - attr-associated elements, which is a FrozenArray<T>?. It is initially null.

      • +
      • Reflected targets that attr appears on + have cached attr-associated elements, which is a FrozenArray<T>?. It is initially null.

      • -
      • -

        Elements of the type this IDL attribute appears on have attr-associated elements. To compute the attr-associated - elements for such an element element:

        +
      • +

        Reflected targets that attr appears on have + attr-associated elements. To compute + the attr-associated elements for such a reflected target + reflectedTarget:

        -
          -
        1. Let elements be an empty list.

        2. +
            +
          1. Let elements be an empty list.

          2. -
          3. -

            If element's explicitly set attr-elements is not - null, then:

            +
          4. Let element be the result of running reflectedTarget's get + the element.

          5. -
              -
            1. -

              For each attrElement in the element's - explicitly set attr-elements:

              +
            2. +

              If reflectedTarget's explicitly set attr-elements is not + null:

              -
                -
              1. If attrElement is not a descendant of any of element's shadow-including ancestors, then - continue.

              2. +
                  +
                1. +

                  For each attrElement in + reflectedTarget's explicitly set attr-elements:

                  -
                2. Append attrElement to elements.

                3. -
                - -
              -
            3. +
                +
              1. If attrElement is not a descendant of any of + element's shadow-including + ancestors, then continue.

              2. -
              3. -

                Otherwise:

                -
                  -
                1. If the content attribute is not present on element, return null.

                2. +
                3. Append attrElement to + elements.

                4. +
                +
              4. +
              + -
            4. Let tokens be the content attribute's value, split on ASCII whitespace. +

            5. +

              Otherwise:

              -
            6. -

              For each id in tokens:

              -
                -
              1. -

                Let candidate be the first element, in tree order, that meets the - following criteria:

                +
                  +
                1. Let contentAttributeValue be the result of running + reflectedTarget's get the content attribute. -

                    -
                  • candidate's root is the same as element's - root,
                  • -
                  • candidate's ID is id, and
                  • -
                  • candidate implements T.
                  • -
                  +
                2. If contentAttributeValue is null, then return null.

                3. -

                  If no such element exists, then continue.

                  - +
                4. Let tokens be contentAttributeValue, split on ASCII whitespace. -

                5. Append candidate to - elements.

                6. -
                -
              2. -
              -
            7. +
            8. +

              For each id of tokens:

              -
            9. Return elements.

            10. -
            +
              +
            1. +

              Let candidate be the first element, in tree order, that meets + the following criteria:

              -

              Other parts of this specification, or other specifications using attribute - reflection, are expected to consult an element's attr-associated - elements. An element's explicitly set attr-elements is an internal - implementation detail of its attr-associated elements and is not to be - used directly. Similarly, the element's cached attr-associated elements - is an internal implementation detail of the IDL attribute's getter.

              -
            2. +
                +
              • candidate's root is the same as element's + root,
              • +
              • candidate's ID is id, and
              • +
              • candidate implements T.
              • +
              + +

              If no such element exists, then continue.

              + + +
            3. Append candidate to + elements.

            4. +
            + +
          + + +
        3. Return elements.

        4. +
        + +

        Other parts of this specification, or other specifications using attribute + reflection, are expected to consult a reflected target's + attr-associated elements. A reflected target's + explicitly set attr-elements is an internal implementation detail of its + attr-associated elements and is not to be used directly. Similarly, a + reflected target's cached attr-associated elements is an + internal implementation detail of the IDL attribute's getter.

        +
      • The getter steps are:

        @@ -8070,13 +8355,14 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
      • Set this's explicitly set attr-elements to null.

      • -
      • Remove the content attribute from this.

      • +
      • Run this's delete the content attribute.

      • Return.

      • -
      • Set the content attribute's value for this to the empty string.

      • +
      • Run this's set the content attribute with the empty + string.

      • Let elements be an empty list.

      • @@ -8095,13 +8381,14 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
      • -

        The following attribute change - steps, given element, localName, oldValue, - value, and namespace, are used to synchronize between the content - attribute and the IDL attribute:

        +

        For element reflected targets only: the following + attribute change steps, given + element, localName, oldValue, value, and + namespace, are used to synchronize between the content attribute and the IDL + attribute:

          -
        1. If localName is not the content attribute's local name, or +

        2. If localName is not the reflected content attribute name, or namespace is not null, then return.

        3. Set element's explicitly set attr-elements to @@ -13929,7 +14216,7 @@ interface DOMStringMap { semantics are determined as follows:

            -
          1. Let map be element's native accessibility semantics +

          2. Let map be element's internal content attribute map.

          3. If map["role"] exists, @@ -13943,7 +14230,7 @@ interface DOMStringMap { follows:

              -
            1. Let map be element's native accessibility semantics +

            2. Let map be element's internal content attribute map.

            3. If map[stateOrProperty] exists, @@ -71057,7 +71344,7 @@ interface ElementInternals { }; // Accessibility semantics -ElementInternals includes ARIAMixin; +ElementInternals includes ARIAMixin; dictionary ValidityStateFlags { boolean valueMissing = false; @@ -71380,43 +71667,10 @@ dictionary ValidityStateFlags {

              -

              Each custom element has a native accessibility semantics map, which is - a map, initially empty. See the Requirements related to ARIA and - to platform accessibility APIs section for information on how this impacts platform - accessibility APIs.

              - -

              ElementInternals includes the ARIAMixin mixin. The accessors provided - by this mixin are used to manipulate the target element's - native accessibility semantics map, as follows:

              - -

              The ARIAMixin getter - steps for ElementInternals, given internals, - idlAttribute, and contentAttribute, are:

              - -
                -
              1. Let map be internals's target - element's native accessibility semantics map.

              2. - -
              3. If map[contentAttribute] exists, - then return it.

              4. - -
              5. Return null.

              6. -
              - -

              The ARIAMixin setter steps for ElementInternals, given - internals, idlAttribute, contentAttribute, and - value, are:

              - -
                -
              1. Let map be internals's target - element's native accessibility semantics map.

              2. - -
              3. If value is null, then remove - map[contentAttribute].

              4. - -
              5. Otherwise, set map[contentAttribute] - to value.

              6. -
              +

              Each custom element has an internal content attribute map, which is a + map, initially empty. See the Requirements + related to ARIA and to platform accessibility APIs section for information on how this impacts + platform accessibility APIs.