diff --git a/dom.bs b/dom.bs index 2a7c77e07..caa860474 100644 --- a/dom.bs +++ b/dom.bs @@ -2177,6 +2177,10 @@ steps:

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

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

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

  • @@ -2195,7 +2199,16 @@ for a given slot slot, run these steps:

    host.

  • -

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

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

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

    2. If parent is a shadow host and node is a +

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

    4. If parent's root is a shadow root, and @@ -2649,8 +2663,16 @@ indicated in the remove algorithm below.

    5. Remove node from its parent's children. -

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

    7. +

      If node is assigned, then: + +

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

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

    8. If parent's root is a shadow root, and parent is a slot whose assigned nodes is the empty list, @@ -2660,6 +2682,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 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.

      3. Run assign slottables for a tree with node. @@ -5693,11 +5720,13 @@ 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; }; enum ShadowRootMode { "open", "closed" }; +enum SlotAssignmentMode { "manual", "name" };

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

        +

        Shadow roots have an associated slot assignment +("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 root of event's path's first struct's @@ -5733,6 +5765,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 @@ -5856,6 +5891,7 @@ interface Element : Node { dictionary ShadowRootInit { required ShadowRootMode mode; boolean delegatesFocus = false; + SlotAssignmentMode slotAssignment = "name"; }; @@ -6740,6 +6776,9 @@ invoked, must run these steps: "custom", then set shadow's available to element internals to true. +

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

      5. Set this's shadow root to shadow.

      6. Return shadow. @@ -10137,6 +10176,7 @@ Yehuda Katz, Yoav Weiss, Yoichi Osato, Yoshinori Sano, +Yu Han, Yusuke Abe, and Zack Weinberg for being awesome!