From 51f3b9373bc510b68c75dd27946f04abfe6bb7ec Mon Sep 17 00:00:00 2001 From: Yu Han Date: Wed, 22 Apr 2020 01:51:16 -0700 Subject: [PATCH 01/15] Add Imperative Slot API --- dom.bs | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/dom.bs b/dom.bs index 8628dce75..615264905 100644 --- a/dom.bs +++ b/dom.bs @@ -2195,6 +2195,11 @@ steps:

  • If the open flag is set and shadow's mode is not "open", then return null.

  • +
  • If the shadow's slot assignment is set to "manual", + return the associated slot in shadow where the slottable is + assigned, + otherwise return null.

  • +
  • Return the first slot in tree order in shadow's descendants whose name is slottable's name, if any, and null otherwise.

  • @@ -5713,9 +5718,11 @@ interface ShadowRoot : DocumentFragment { readonly attribute ShadowRootMode mode; readonly attribute Element host; attribute EventHandler onslotchange; + readonly attribute SlotAssignmentMode slotAssignment; }; enum ShadowRootMode { "open", "closed" }; +enum SlotAssignmentMode { "manual", "auto" };

    {{ShadowRoot}} nodes are simply known as @@ -5731,6 +5738,9 @@ It is initially set to false.

    +

    Shadow roots have an associated slot assignment +("manual" or "auto"). It is default to "auto"

    +

    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 @@ -5748,6 +5758,9 @@ null if event's composed flag is unset and shadow roo onslotchange event handler, whose event handler event type is {{HTMLSlotElement/slotchange}}. +

    The slotAssignment attribute's getter must +return this's slot assignment.

    +

    In shadow-including tree order is @@ -5871,6 +5884,7 @@ interface Element : Node { dictionary ShadowRootInit { required ShadowRootMode mode; boolean delegatesFocus = false; + SlotAssignmentMode slotAssignment = "auto"; }; @@ -6744,6 +6758,9 @@ invoked, must run these steps:

  • Set shadow's delegates focus to init's {{ShadowRootInit/delegatesFocus}}. +

  • Set shadow's slot assignment to init's + {{ShadowRootInit/slotAssignment}}. +

  • Set this's shadow root to shadow.

  • Return shadow. @@ -10187,7 +10204,8 @@ Xidorn Quan, Yehuda Katz, Yoav Weiss, Yoichi Osato, -Yoshinori Sano, and +Yoshinori Sano, +Yu Han, and Zack Weinberg for being awesome! From bc401e18deb5c0c0237aa5a01bb6fadadadf9735 Mon Sep 17 00:00:00 2001 From: Yu Han Date: Fri, 24 Apr 2020 09:12:42 -0700 Subject: [PATCH 02/15] Update slot assignment default wording --- dom.bs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dom.bs b/dom.bs index 615264905..1ee775f58 100644 --- a/dom.bs +++ b/dom.bs @@ -5739,7 +5739,7 @@ It is initially set to false.

    consequences for innerHTML. -->

    Shadow roots have an associated slot assignment -("manual" or "auto"). It is default to "auto"

    +("manual" or "auto"), whose default value is "auto"

    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 From c62252eaee84577f28c5d1c93860b5e7a1501116 Mon Sep 17 00:00:00 2001 From: Yu Han Date: Wed, 29 Apr 2020 09:26:43 -0700 Subject: [PATCH 03/15] Updates Imperative Slot API spec. --- dom.bs | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/dom.bs b/dom.bs index 1ee775f58..ebb511dd8 100644 --- a/dom.bs +++ b/dom.bs @@ -2195,10 +2195,24 @@ steps:

  • If the open flag is set and shadow's mode is not "open", then return null.

  • -
  • If the shadow's slot assignment is set to "manual", - return the associated slot in shadow where the slottable is - assigned, - otherwise return null.

  • +
  • If the shadow's slot assignment is set to "manual", then:

    +
      +
    1. Let manuallyAssignedNodes be nodes that are + assigned + to a slot in shadow's descendants.

    2. + +
    3. If nodeSlotMap doesn't exists, let nodeSlotMap be an empty map.

    4. + +
    5. For each node in manuallyAssignedNodes, set nodeSlotMap[node] + to slot.

    6. + +
    7. Set manuallyAssignedNodes to empty list.

    8. + +
    9. If nodeSlotMap[slottable] exists, then return nodeSlotMap[slottable].

    10. + +
    11. Return null.

    12. +
    +
  • Return the first slot in tree order in shadow's descendants whose name is slottable's @@ -5716,9 +5730,9 @@ invoked, must return a new {{DocumentFragment}} node whose no [Exposed=Window] interface ShadowRoot : DocumentFragment { readonly attribute ShadowRootMode mode; + readonly attribute SlotAssignmentMode slotAssignment; readonly attribute Element host; attribute EventHandler onslotchange; - readonly attribute SlotAssignmentMode slotAssignment; }; enum ShadowRootMode { "open", "closed" }; @@ -5739,7 +5753,7 @@ It is initially set to false.

    consequences for innerHTML. -->

    Shadow roots have an associated slot assignment -("manual" or "auto"), whose default value is "auto"

    +("manual" or "auto"), whose default value is "auto".

    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 From 4998818363afe60efe93ebd6672d5c1db07ee1c2 Mon Sep 17 00:00:00 2001 From: Yu Han Date: Thu, 14 May 2020 13:42:19 -0700 Subject: [PATCH 04/15] Updates to include manuallyAssignedNodes. --- dom.bs | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/dom.bs b/dom.bs index ebb511dd8..a957e04b2 100644 --- a/dom.bs +++ b/dom.bs @@ -2195,24 +2195,9 @@ steps:

  • If the open flag is set and shadow's mode is not "open", then return null.

  • -
  • If the shadow's slot assignment is set to "manual", then:

    -
      -
    1. Let manuallyAssignedNodes be nodes that are - assigned - to a slot in shadow's descendants.

    2. - -
    3. If nodeSlotMap doesn't exists, let nodeSlotMap be an empty map.

    4. - -
    5. For each node in manuallyAssignedNodes, set nodeSlotMap[node] - to slot.

    6. - -
    7. Set manuallyAssignedNodes to empty list.

    8. - -
    9. If nodeSlotMap[slottable] exists, then return nodeSlotMap[slottable].

    10. - -
    11. Return null.

    12. -
    -
  • +
  • If the shadow's slot assignment is set to "manual", + return the associated slot in shadow's tree whose manuallyAssignedNodes includes + slottable, if any, and null otherwise.

  • Return the first slot in tree order in shadow's descendants whose name is slottable's From d09a9781dd1ddd8af173a9e90a8ff1609af99054 Mon Sep 17 00:00:00 2001 From: Yu Han Date: Fri, 5 Jun 2020 11:54:31 -0700 Subject: [PATCH 05/15] Update Imperative Slot API dom spec --- dom.bs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dom.bs b/dom.bs index a957e04b2..a30cfe45d 100644 --- a/dom.bs +++ b/dom.bs @@ -2196,8 +2196,8 @@ steps:

    not "open", then return null.

  • If the shadow's slot assignment is set to "manual", - return the associated slot in shadow's tree whose manuallyAssignedNodes includes - slottable, if any, and null otherwise.

  • + return the slot in shadow's descendants whose manuallyAssignedNodes + includes slottable, if any, and null otherwise.

  • Return the first slot in tree order in shadow's descendants whose name is slottable's @@ -5738,7 +5738,7 @@ It is initially set to false.

    consequences for innerHTML. -->

    Shadow roots have an associated slot assignment -("manual" or "auto"), whose default value is "auto".

    +("manual" or "auto").

    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 From d07a8437dbc8168ec9fea3f0ea20059aa315f00c Mon Sep 17 00:00:00 2001 From: yuzhehan <57230755+yuzhe-han@users.noreply.github.com> Date: Wed, 17 Jun 2020 06:19:14 -0700 Subject: [PATCH 06/15] Update dom.bs Co-authored-by: Anne van Kesteren --- dom.bs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dom.bs b/dom.bs index a30cfe45d..6c8d9cf8f 100644 --- a/dom.bs +++ b/dom.bs @@ -2196,7 +2196,7 @@ steps:

    not "open", then return null.

  • If the shadow's slot assignment is set to "manual", - return the slot in shadow's descendants whose manuallyAssignedNodes + return the slot in shadow's descendants whose manuallyAssignedNodes includes slottable, if any, and null otherwise.

  • Return the first slot in tree order in shadow's From eed81d32cfc766968fc6f457426149e9189b9d08 Mon Sep 17 00:00:00 2001 From: yuzhehan <57230755+yuzhe-han@users.noreply.github.com> Date: Wed, 17 Jun 2020 06:19:51 -0700 Subject: [PATCH 07/15] Update dom.bs Co-authored-by: Anne van Kesteren --- dom.bs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dom.bs b/dom.bs index 6c8d9cf8f..4d7ea5a47 100644 --- a/dom.bs +++ b/dom.bs @@ -2195,7 +2195,7 @@ steps:

  • If the open flag is set and shadow's mode is not "open", then return null.

  • -
  • If the shadow's slot assignment is set to "manual", +

  • If shadow's slot assignment is set to "manual", return the slot in shadow's descendants whose manuallyAssignedNodes includes slottable, if any, and null otherwise.

  • From e8fdb61e2fd1188629f90b7596599d9ab7ed672e Mon Sep 17 00:00:00 2001 From: Yu Han Date: Wed, 17 Jun 2020 09:36:06 -0700 Subject: [PATCH 08/15] Update Imperative Slot API Spec. --- dom.bs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dom.bs b/dom.bs index 4d7ea5a47..1f249493f 100644 --- a/dom.bs +++ b/dom.bs @@ -2196,7 +2196,7 @@ steps:

    not "open", then return null.

  • If shadow's slot assignment is set to "manual", - return the slot in shadow's descendants whose manuallyAssignedNodes + return the slot in shadow's descendants whose manually assigned nodes includes slottable, if any, and null otherwise.

  • Return the first slot in tree order in shadow's @@ -2284,6 +2284,10 @@ run these steps:

  • Set slot's assigned nodes to slottables. +

  • If slot's root is a shadow root and its + slot assignment is "manual", then set slot's + manually assigned nodes to slottables. +

  • For each slottable in slottables, set slottable's assigned slot to slot. From 3ab244d871f9cdd4579fd28a26ccdd03e11ec140 Mon Sep 17 00:00:00 2001 From: Yu Han Date: Fri, 17 Jul 2020 19:17:51 -0700 Subject: [PATCH 09/15] Update Imperative Slot API DOM spec --- dom.bs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/dom.bs b/dom.bs index 1f249493f..47ef08f22 100644 --- a/dom.bs +++ b/dom.bs @@ -2284,10 +2284,6 @@ run these steps:

  • Set slot's assigned nodes to slottables. -

  • If slot's root is a shadow root and its - slot assignment is "manual", then set slot's - manually assigned nodes to slottables. -

  • For each slottable in slottables, set slottable's assigned slot to slot. From ae51d53dfa8e17d615f62b3c428a51fa551de580 Mon Sep 17 00:00:00 2001 From: Yu Han Date: Wed, 22 Jul 2020 02:32:38 -0700 Subject: [PATCH 10/15] Update Slot Imperative API DOM spec. --- dom.bs | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/dom.bs b/dom.bs index 47ef08f22..19bbc9600 100644 --- a/dom.bs +++ b/dom.bs @@ -2454,14 +2454,17 @@ before a child, with an optional suppress observers flag, run

  • Otherwise, insert node into parent's children before child's index. -

  • If parent is a shadow host and node is a +

  • If parent is a shadow host with its root's + slot assignment set to "auto" and node is a slottable, then assign a slot for node.

  • If parent's root is a shadow root, and parent is a slot whose assigned nodes is the empty list, then run signal a slot change for parent. -

  • Run assign slottables for a tree with node's root. +

  • If node's root is a shadow root with its root's + slot assignment set to "auto", then run assign slottables for a tree + with node's root.

  • For each shadow-including inclusive descendant inclusiveDescendant of @@ -2671,8 +2674,16 @@ indicated in the remove algorithm below.

  • Remove node from its parent's children. -

  • If node is assigned, then run assign slottables for - node's assigned slot. +

  • +

    If node is assigned, then: + +

      +
    1. If parent's root is a shadow root with its + root's slot assignment set to "auto", + then remove node from its assigned slot's manually assigned nodes. + +

    2. Run assign slottables for node's assigned slot. +

  • If parent's root is a shadow root, and parent is a slot whose assigned nodes is the empty list, @@ -2682,6 +2693,11 @@ indicated in the remove algorithm below.

    If node has an inclusive descendant that is a slot, then:

      +
    1. for each slot slot in node's inclusive descendants, + if slot's root is a shadow root with its root's + slot assignment set to "manual", then set slot's + manually assigned nodes to an empty list. +

    2. Run assign slottables for a tree with parent's root.

    3. Run assign slottables for a tree with node. From adf8f6411b360fe006a07f7b88bf39e8c5cff170 Mon Sep 17 00:00:00 2001 From: Yu Han Date: Wed, 22 Jul 2020 02:43:57 -0700 Subject: [PATCH 11/15] Update Slot Imperative API DOM Spec. --- dom.bs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/dom.bs b/dom.bs index 19bbc9600..45c9d35a3 100644 --- a/dom.bs +++ b/dom.bs @@ -2462,9 +2462,7 @@ before a child, with an optional suppress observers flag, run parent is a slot whose assigned nodes is the empty list, then run signal a slot change for parent. -

    4. If node's root is a shadow root with its root's - slot assignment set to "auto", then run assign slottables for a tree - with node's root. +

    5. Run assign slottables for a tree with node's root.

    6. For each shadow-including inclusive descendant inclusiveDescendant of From 26b8b9928797f24e5d64256234fbbd39c34b2175 Mon Sep 17 00:00:00 2001 From: Yu Han Date: Fri, 16 Oct 2020 19:17:31 -0700 Subject: [PATCH 12/15] Update Imperative Slot API DOM spec --- dom.bs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dom.bs b/dom.bs index 45c9d35a3..9a8c159d8 100644 --- a/dom.bs +++ b/dom.bs @@ -2196,8 +2196,8 @@ steps:

      not "open", then return null.

    7. If shadow's slot assignment is set to "manual", - return the slot in shadow's descendants whose manually assigned nodes - includes slottable, if any, and null otherwise.

    8. + then return the slot in shadow's descendants whose manually assigned nodes + contains slottable, if any, and null otherwise.

    9. Return the first slot in tree order in shadow's descendants whose name is slottable's @@ -2676,7 +2676,7 @@ indicated in the remove algorithm below.

      If node is assigned, then:

        -
      1. If parent's root is a shadow root with its +

      2. If parent's root is a shadow root with its root's slot assignment set to "auto", then remove node from its assigned slot's manually assigned nodes. From 901506d2d0739ba13da31bfe3a809ddfc172da23 Mon Sep 17 00:00:00 2001 From: Yu Han Date: Fri, 16 Oct 2020 20:28:16 -0700 Subject: [PATCH 13/15] Update Imperative Slot API DOM spec --- dom.bs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dom.bs b/dom.bs index 488a4509e..b413c3eb5 100644 --- a/dom.bs +++ b/dom.bs @@ -2667,7 +2667,7 @@ indicated in the remove algorithm below.

        1. If parent's root is a shadow root with its - root's slot assignment set to "auto", + root's slot assignment set to "manual", then remove node from its assigned slot's manually assigned nodes.

        2. Run assign slottables for node's assigned slot. From 31ab4801e99ef45bdeb8fcd409eecd65fddb338c Mon Sep 17 00:00:00 2001 From: Yu Han Date: Wed, 11 Nov 2020 19:55:04 -0800 Subject: [PATCH 14/15] Update Imperative Slot API DOM spec --- dom.bs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/dom.bs b/dom.bs index b413c3eb5..153fb5b83 100644 --- a/dom.bs +++ b/dom.bs @@ -2185,7 +2185,7 @@ steps:

        3. If the open flag is set and shadow's mode is not "open", then return null.

        4. -
        5. If shadow's slot assignment is set to "manual", +

        6. If shadow's slot assignment is "manual", then return the slot in shadow's descendants whose manually assigned nodes contains slottable, if any, and null otherwise.

        7. @@ -2444,8 +2444,8 @@ before a child, with an optional suppress observers flag, run
        8. Otherwise, insert node into parent's children before child's index. -

        9. If parent is a shadow host with its root's - slot assignment set to "auto" and node is a +

        10. If parent is a shadow host whose shadow root's + slot assignment is "auto" and node is a slottable, then assign a slot for node.

        11. If parent's root is a shadow root, and @@ -2666,8 +2666,8 @@ indicated in the remove algorithm below.

          If node is assigned, then:

            -
          1. If parent's root is a shadow root with its - root's slot assignment set to "manual", +

          2. If parent's root is a shadow root whose + root's slot assignment is "manual", then remove node from its assigned slot's manually assigned nodes.

          3. Run assign slottables for node's assigned slot. @@ -2682,9 +2682,9 @@ indicated in the remove algorithm below.

            1. for each slot slot in node's inclusive descendants, - if slot's root is a shadow root with its root's - slot assignment set to "manual", then set slot's - manually assigned nodes to an empty list. + if slot's root is a shadow root whose root's + slot assignment is "manual", then set slot's + manually assigned nodes to an empty set.

            2. Run assign slottables for a tree with parent's root. From 49ce9861f326c9e4337338316bc1e8d29a2495a9 Mon Sep 17 00:00:00 2001 From: Yu Han Date: Thu, 31 Dec 2020 13:10:04 -0800 Subject: [PATCH 15/15] Update imperative slot assignment DOM spec --- dom.bs | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/dom.bs b/dom.bs index 4f70fabf4..caa860474 100644 --- a/dom.bs +++ b/dom.bs @@ -2199,7 +2199,16 @@ for a given slot slot, run these steps:

              host.

            3. -

              For each slottable child of host, slottable, in +

              If slot's shadow root's slot assignment is "manual", + then:

              + +
                +
              1. Set result to slot's manually assigned nodes.

              2. +
              +
            4. + +
            5. +

              Otherwise, for each slottable child of host, slottable, in tree order:

                @@ -2437,7 +2446,7 @@ before a child, with an optional suppress observers flag, run children before child's index.
              1. If parent is a shadow host whose shadow root's - slot assignment is "auto" and node is a + slot assignment is "name" and node is a slottable, then assign a slot for node.

              2. If parent's root is a shadow root, and @@ -5717,7 +5726,7 @@ interface ShadowRoot : DocumentFragment { }; enum ShadowRootMode { "open", "closed" }; -enum SlotAssignmentMode { "manual", "auto" }; +enum SlotAssignmentMode { "manual", "name" };

                {{ShadowRoot}} nodes are simply known as @@ -5737,7 +5746,7 @@ It is initially set to false.

                consequences for innerHTML. -->

                Shadow roots have an associated slot assignment -("manual" or "auto").

                +("manual" or "name").

                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 @@ -5882,7 +5891,7 @@ interface Element : Node { dictionary ShadowRootInit { required ShadowRootMode mode; boolean delegatesFocus = false; - SlotAssignmentMode slotAssignment = "auto"; + SlotAssignmentMode slotAssignment = "name"; };