From 25e5809b1baa8e2ef5ccc87606fc6944f4a153e0 Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Thu, 15 Dec 2022 17:20:28 +0100 Subject: [PATCH] Fill in details for reflecting DOMString as an awkward example --- source | 94 +++++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 61 insertions(+), 33 deletions(-) diff --git a/source b/source index c2ade19dbd4..5facd98815e 100644 --- a/source +++ b/source @@ -7596,21 +7596,26 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute

Reflected targets have these associated algorithms:

-

For elements these are defined as follows: +

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

+
get the element
+

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, and the reflected - target.

  2. + name given null, the reflected content attribute, and + element.

  3. If attribute is null, then return null.

  4. @@ -7619,27 +7624,47 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
-
set the content attribute with a string value +
set the content attribute with a string value

Set an attribute value given - the reflected target, the reflected content attribute, and - value. + element, the reflected content attribute, and value.

-
delete the content attribute +
delete the content attribute

Remove an attribute by - namespace and local name given null, the reflected content attribute, and the - reflected target.

+ namespace and local name given null, the reflected content attribute, and + element.

-
+

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

+ +
+
get the element
+

Return elementInternals's target + element.

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

  2. Return elementInternals's target + element's native accessibility semantics map[the reflected content + attribute].

  3. +
+
-

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.

+
set the content attribute with a string value
+

Set elementInternals's target element's native accessibility semantics + map[the reflected content attribute] to value.

-

For ElementInternals objects the content attributes are the keys of their target element's native - accessibility semantics map. Any manipulation of content attributes as part of the - reflect algorithms ends up impacting that map accordingly.

+
delete the content attribute
+

Remove elementInternals's target element's native accessibility semantics + map[the reflected content attribute].

+

This results in somewhat redundant data structures for ElementInternals objects as their target @@ -7648,6 +7673,8 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute chosen to make it less error-prone to define IDL attributes shared between reflected targets.

+
+

IDL attributes of type DOMString or DOMString? that reflect enumerated content attributes can be limited to only known values. @@ -7662,30 +7689,31 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute

  1. -

    If the content attribute is an enumerated attribute, and the IDL attribute is - limited to only known values:

    +

    If the attribute defined for the reflected target's get the + element, with namespace null and local name reflected content attribute, + is an enumerated attribute, and the reflected IDL attribute of the + reflected object is limited to only known values:

    +
      -
    1. If the content attribute is not in any state (e.g., the attribute is missing and there - is no missing value default), or the content attribute - is in a state with no associated keyword value, then return the empty string.

    2. - -
    3. Return the canonical keyword for the state of the content - attribute.

    4. +
    5. If the reflected target's get the content attribute is not + in any state (e.g., the return value is null and there is no missing value default), or the content attribute is in a state with no + associated keyword value, then return the empty string.

    6. + + +
    7. Return the canonical keyword for the state of the reflected + target's get the content attribute.

  2. -
  3. -

    Otherwise:

    - -
      -
    1. Return the content attribute's value.

    2. -
    -
  4. +
  5. Return the reflected target's get the content + attribute.

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

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

  • If a reflecting IDL attribute has the type