From e06f9031447d5afbc1d7469432a0df54de23a60d Mon Sep 17 00:00:00 2001 From: Dan Clark Date: Tue, 4 Feb 2025 20:13:45 +0000 Subject: [PATCH 1/3] Add reference target to shadow root --- dom.bs | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/dom.bs b/dom.bs index 8645c1ff4..12e58fb52 100644 --- a/dom.bs +++ b/dom.bs @@ -4587,8 +4587,9 @@ and an optional document docume
  • Attach a shadow root with copy, node's shadow root's mode, true, node's shadow root's serializable, node's - shadow root's delegates focus, and node's - shadow root's slot assignment. + shadow root's delegates focus, node's + shadow root's slot assignment, and node's + shadow root's reference target.

  • Set copy's shadow root's declarative to node's shadow root's declarative. @@ -6057,6 +6058,7 @@ interface ShadowRoot : DocumentFragment { readonly attribute boolean clonable; readonly attribute boolean serializable; readonly attribute Element host; + attribute DOMString? referenceTarget; attribute EventHandler onslotchange; }; @@ -6092,6 +6094,9 @@ It is initially set to false.

    Shadow roots have an associated serializable (a boolean). It is initially set to false.

    +

    Shadow roots have an associated reference target. +It is initially set to null.

    +

    A shadow root's get the parent algorithm, given an event, returns null if event's composed flag is unset and shadow root is the root of event's path's first struct's @@ -6116,6 +6121,12 @@ null if event's composed flag is unset and shadow roo

    The host getter steps are to return this's host. +

    The referenceTarget getter steps are to return +this's reference target. + +

    The {{ShadowRoot/referenceTarget}} setter steps are to set +this's reference target to the given value. +

    The onslotchange attribute is an event handler IDL attribute for the onslotchange event handler, whose @@ -6246,6 +6257,7 @@ dictionary ShadowRootInit { SlotAssignmentMode slotAssignment = "named"; boolean clonable = false; boolean serializable = false; + DOMString? referenceTarget = null; }; @@ -7099,8 +7111,9 @@ are:

  • Run attach a shadow root with this, init["{{ShadowRootInit/mode}}"], init["{{ShadowRootInit/clonable}}"], init["{{ShadowRootInit/serializable}}"], - init["{{ShadowRootInit/delegatesFocus}}"], and - init["{{ShadowRootInit/slotAssignment}}"]. + init["{{ShadowRootInit/delegatesFocus}}"], + init["{{ShadowRootInit/slotAssignment}}"], and + init["{{ShadowRootInit/referenceTarget}}"].

  • Return this's shadow root. @@ -7109,8 +7122,8 @@ are:

    To attach a shadow root, given an element element, a string mode, a boolean clonable, -a boolean serializable, a boolean delegatesFocus, and a string -slotAssignment: +a boolean serializable, a boolean delegatesFocus, a string +slotAssignment, and null or a string referenceTarget:

    1. If element's namespace is not the HTML namespace, @@ -7178,6 +7191,8 @@ a boolean serializable, a boolean delegatesFocus, and a st

    2. Set shadow's slot assignment to slotAssignment. +

    3. Set shadow's reference target to referenceTarget. +

    4. Set shadow's declarative to false.

    5. Set shadow's clonable to clonable. From 496ccae036e0c2190546790156634bc3ac9c614d Mon Sep 17 00:00:00 2001 From: Dan Clark Date: Tue, 6 May 2025 23:15:40 +0000 Subject: [PATCH 2/3] Make order consistent with other ShadowRoot properties --- dom.bs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/dom.bs b/dom.bs index 4759dc811..80905b01b 100644 --- a/dom.bs +++ b/dom.bs @@ -6384,6 +6384,12 @@ false.

      Shadow roots have an associated clonable (a boolean). It is initially set to false.

      +

      Shadow roots have an associated serializable (a boolean). +It is initially set to false.

      + +

      Shadow roots have an associated reference target. +It is initially set to null.

      +

      Shadow roots have an associated custom element registry (null or a {{CustomElementRegistry}} object). It is initially null.

      @@ -6394,12 +6400,6 @@ It is initially set to false.

      matters for as long as the shadow root's custom element registry is null. -

      Shadow roots have an associated serializable (a boolean). -It is initially set to false.

      - -

      Shadow roots have an associated reference target. -It is initially set to null.

      -

      A shadow root's get the parent algorithm, given an event, returns @@ -6562,8 +6562,8 @@ dictionary ShadowRootInit { SlotAssignmentMode slotAssignment = "named"; boolean clonable = false; boolean serializable = false; - CustomElementRegistry customElementRegistry; DOMString? referenceTarget = null; + CustomElementRegistry customElementRegistry; }; @@ -7550,14 +7550,14 @@ a boolean serializable, a boolean delegatesFocus, a string

    6. Set shadow's slot assignment to slotAssignment. -

    7. Set shadow's reference target to referenceTarget. -

    8. Set shadow's declarative to false.

    9. Set shadow's clonable to clonable.

    10. Set shadow's serializable to serializable. +

    11. Set shadow's reference target to referenceTarget. +

    12. Set shadow's custom element registry to registry. From 64676d640f2427741f4d8371d1f47e01a3559be1 Mon Sep 17 00:00:00 2001 From: Dan Clark Date: Tue, 6 May 2025 23:21:59 +0000 Subject: [PATCH 3/3] Add type declaration for ShadowRoot reference target --- dom.bs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dom.bs b/dom.bs index 80905b01b..9014a5e34 100644 --- a/dom.bs +++ b/dom.bs @@ -6387,8 +6387,8 @@ It is initially set to false.

      Shadow roots have an associated serializable (a boolean). It is initially set to false.

      -

      Shadow roots have an associated reference target. -It is initially set to null.

      +

      Shadow roots have an associated reference target +(null or a string). It is initially set to null.

      Shadow roots have an associated custom element registry (null or a {{CustomElementRegistry}} object). It is initially null.