diff --git a/source b/source index 2f6d690e48d..062b98dd805 100644 --- a/source +++ b/source @@ -3203,7 +3203,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
  • node document concept
  • document type concept
  • host concept
  • -
  • The shadow root concept, and its delegates focus, available to element internals, clonable, and serializable.
  • +
  • The shadow root concept, and its delegates focus, available to element internals, clonable, serializable, and reference target
  • The shadow host concept
  • HTMLCollection interface, its length attribute, and its @@ -5187,6 +5187,184 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute +

    Element reference attributes

    + +

    + Element reference attributes refer to one or more Elements in the document. When specified + as content attributes, element reference attributes refer to other Elements + via their IDs.

    + +

    The steps to resolve the reference + target on an element element referred to by an + element reference attribute are:

    + +
      +
    1. If element does not have a shadow root, or element's + shadow root's reference target is null, return element.

      +
    2. + +
    3. Let referenceTarget be the value of element's shadow + root's reference target.

    4. + +
    5. Let candidate be the first element in element's shadow + root whose ID matches referenceTarget.

      +
    6. + +
    7. If no such element exists, return null.

    8. + +
    9. Return the result of resolving the reference + target on candidate. +

    10. +
    + +
    Single element reference attributes
    + +

    Single element reference attributes refer to a single Element. When specified as a + content attribute, a single element reference attribute consists of a single token + which should completely match the ID of another element in the + document.

    + +

    The rules to get the + attr-associated element for an element reference attribute attr and + element element, are:

    + +
      +
    1. If the attribute is not specified on element, return null.

    2. + +
    3. +

      If element has an explicitly-set + attr-element which is not null:

      + +
        +
      1. If element's explicitly-set + attr-element is a descendant of any of element's + shadow-including ancestors, then let + candidate be element's + explicitly-set attr-element.

        +
      2. + +
      3. Otherwise, let candidate be null.

      4. +
      + +
    4. + +
    5. +

      Otherwise: + +

        +
      1. Let value be the attribute value.

      2. + +
      3. Let candidate be the first element in element's tree, + in tree order whose ID is value.

        +
      4. + +
      5. If no such element exists, let candidate be null.

        +
      6. +
      +
    6. + +
    7. If candidate is null, return null.
    8. + +
    9. Return the result of resolving the reference + target on candidate. +

    10. +
    + +
    Multiple element reference attributes
    + +

    Multiple element reference attributes + refer to multiple Elements. When specified as a content attribute, a multiple element + reference attribute consists of space-separated tokens, each of which should completely + match the ID of another element in the document.

    + +

    The rules to get the attr-associated + elements for a multiple element reference attribute attr and element + elementare:

    + +
      +
    1. If the attribute is not specified on element, return null.

    2. + +
    3. Let candidates be an empty list.

    4. + +
    5. +

      If element's has an explicitly set attr-elements which + is not null:

      + +
        +
      1. +

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

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

        2. + +
        3. Append attrElement to + candidates.

        4. +
        +
      2. +
      +
    6. + +
    7. +

      Otherwise:

      + +
        +
      1. Let value be the attribute value.

      2. + +
      3. Let tokens be value, split on ASCII whitespace. + +

      4. +

        For each id of tokens:

        + +
          +
        1. +

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

          + +
            +
          • 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.

          +
        2. + +
        3. Append candidate to + candidates.

        4. +
        +
      5. +
      +
    8. + +
    9. Let resolvedCandidates be an empty list.

    10. + +
    11. +

      For each candidate in candidates: +

      + +
        +
      1. Let resolvedCandidate be the result of + resolving the reference target on + candidate.

      2. + +
      3. If resolvedCandidate is not null, append resolvedCandidate to + resolvedCandidates.

      4. +
      +
    12. + +
    13. Return resolvedCandidates.

    14. +

    Numbers

    @@ -8519,59 +8697,23 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute name:

    For those, specification authors must use the reflected target's - get the attr-associated element and get the - attr-associated elements, respectively. The content attribute presence and value - must not be used as they cannot be fully synchronized with the reflected IDL - attribute.

    + get the attr-associated element + and get the attr-associated elements, respectively. The content attribute + presence and value must not be used as they cannot be fully synchronized with the reflected + IDL attribute.

    A reflected target's explicitly set attr-element, explicitly set attr-elements, cached attr-associated @@ -46409,14 +46488,45 @@ interface HTMLLabelElement : HTMLElement {

    The label element represents a caption in a user interface. The caption can be associated with a specific form control, known as the - label element's labeled control, either using the label element's labeled control, either using the for attribute, or by putting the form control inside the label element itself.

    -

    Except where otherwise specified by the following rules, a label element has no - labeled control.

    +

    To determine a label element's labeled control, run these steps:

    + +
      +
    1. +

      If the label's for attribute is + specified, then:

      + +
        +
      1. If the for-associated element is not null, and the for-associated element is a labelable element, return that element.

      2. + +
      3. Otherwise, return null.

      4. +
      +
    2. + +
    3. +

      For each descendant descendant of the + label in tree order:

      + +
        +
      1. Let candidate be the result of + resolving the reference target on + descendant.

      2. + +
      3. If candidate is a labelable element, + return candidate.

      4. +
      +
    4. + +
    5. Return null.

    6. +
    @@ -46424,11 +46534,7 @@ interface HTMLLabelElement : HTMLElement { be specified to indicate a form control with which the caption is to be associated. If the attribute is specified, the attribute's value must be the ID of a labelable element in the same tree as the - label element. If the attribute is specified and there is an element in - the tree whose ID is equal to the value of the for attribute, and the first such element in tree - order is a labelable element, then that element is the - label element's labeled control.

    + label element.

    @@ -64325,6 +64431,7 @@ not-slash = %x0000-002E / %x0030-10FFFF
    shadowrootdelegatesfocus
    shadowrootclonable
    shadowrootserializable
    +
    shadowrootreferencetarget
    Accessibility considerations:
    For authors.
    @@ -64340,6 +64447,7 @@ interface HTMLTemplateElement : HTMLElement { [CEReactions] attribute boolean shadowRootDelegatesFocus; [CEReactions] attribute boolean shadowRootClonable; [CEReactions] attribute boolean shadowRootSerializable; + [CEReactions] attribute DOMString? shadowRootReferenceTarget; };
    Uses HTMLTemplateElement.
    @@ -64388,6 +64496,11 @@ interface HTMLTemplateElement : HTMLElement { data-x="attr-template-shadowrootserializable">shadowrootserializable content attribute is a boolean attribute.

    +

    The shadowrootreferencetarget content + attribute can be set to create a declarative shadow root with the given + reference target.

    +

    The template contents of a template element are not children of the element itself.

    @@ -64540,6 +64653,11 @@ interface HTMLTemplateElement : HTMLElement { must reflect the shadowrootserializable content attribute.

    +

    The shadowRootReferenceTarget IDL + attribute must reflect the + shadowrootreferencetarget content attribute.

    +

    The cloning steps for template @@ -130715,6 +130833,10 @@ document.body.appendChild(text); data-x="attr-template-shadowrootdelegatesfocus">shadowrootdelegatesfocus attribute; otherwise false.

  • +
  • Let referenceTarget be the value of the template start tag's + shadowrootreferencetarget + attribute if it has one; otherwise null.

  • +
  • If declarative shadow host element is a shadow host, then insert an element at the adjusted insertion location with template.

  • @@ -130726,7 +130848,8 @@ document.body.appendChild(text);
  • Attach a shadow root with declarative shadow host element, mode, clonable, - serializable, delegatesFocus, and "named".

    + serializable, delegatesFocus, "named", + and referenceTarget.

    If an exception is thrown, then catch it and:

    @@ -134554,6 +134677,9 @@ document.body.appendChild(text);
  • If shadow's clonable is set, then append " shadowrootclonable=""".

  • +
  • If shadow's reference target is set, then append + " shadowrootreferencetarget=""".

  • +
  • Append ">".

  • Append the value of running the HTML fragment serialization algorithm with @@ -143702,6 +143828,11 @@ interface External { Enables streaming declarative shadow roots "open"; "closed" + + shadowrootreferencetarget + template + Sets reference target on a declarative shadow root + ID or null shadowrootserializable template