diff --git a/source b/source index b8a0cef9a14..5c6020d70fb 100644 --- a/source +++ b/source @@ -3236,6 +3236,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
  • The child concept
  • The root and shadow-including root concepts
  • The inclusive ancestor, + ancestor, descendant, shadow-including ancestor, shadow-including descendant, @@ -3349,6 +3350,8 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
  • signal abort
  • add
  • The get an attribute by name algorithm
  • +
  • The ensure pre-insertion validity algorithm
  • +
  • The convert nodes into a node algorithm
  • The following features are defined in UI Events: UIEVENTS

    @@ -53388,7 +53391,8 @@ You cannot submit this form when the field is incorrect.
    Content model:
    Phrasing content, but there must be no interactive content descendant and no descendant with the tabindex attribute - specified.
    + specified. If the element is the first child of a select element, then it may also + have zero or one selectedcontent element.
    Content attributes:
    Global attributes
    disabled
    @@ -53853,6 +53857,9 @@ interface HTMLSelectElement : HTMLElement {
    1. Set the select element's user validity to true.
    2. +
    3. Run update a select's selectedcontent given the + select element.

    4. +
    5. Fire an event named input at the select element, with the bubbles and composed @@ -54070,13 +54077,22 @@ interface HTMLSelectElement : HTMLElement { order that has its selectedness set to true, if any. If there isn't one, then it must return −1.

      -

      On setting, the selectedIndex attribute must set - the selectedness of all the option - elements in the list of options to false, and - then the option element in the list of - options whose index is the given new value, if - any, must have its selectedness set to true and - its dirtiness set to true.

      +

      On setting, the selectedIndex attribute must run + the following steps:

      + +
        +
      1. Set the selectedness of all the + option elements in the list of + options to false.

      2. + +
      3. The option element in the list of + options whose index is the given new value, if + any, must have its selectedness set to true and + its dirtiness set to true.

      4. + +
      5. Run update a select's selectedcontent given this + select.

      6. +

      This can result in no element having a selectedness set to true even in the case of the @@ -54090,14 +54106,23 @@ interface HTMLSelectElement : HTMLElement { data-x="concept-option-selectedness">selectedness set to true, if any. If there isn't one, then it must return the empty string.

      -

      On setting, the value attribute must set the selectedness of all the option elements - in the list of options to false, and then the - first option element in the list of - options, in tree order, whose value - is equal to the given new value, if any, must have its selectedness set to true and its dirtiness set to true.

      +

      On setting, the value attribute must run the following + steps:

      + +
        +
      1. Set the selectedness of all the + option elements in the list of + options to false.

      2. + +
      3. The first option element in the list of options, in tree order, whose + value is equal to the given new value, if any, must + have its selectedness set to true and its dirtiness set to true.

      4. + +
      5. Run update a select's selectedcontent given this + select.

      6. +

      This can result in no element having a selectedness set to true even in the case of the @@ -54554,6 +54579,52 @@ interface HTMLOptionElement : HTMLElement { +

      To get the option element nearest ancestor select given an + option option:

      + +
        +
      1. +

        For each ancestor of option's ancestors in reverse tree order:

        + +
          +
        1. If ancestor is a select, then return + ancestor.

        2. +
        +
      2. + +
      3. Return null.

      4. +
      + +

      To maybe clone an option into selectedcontent, given an option + option:

      + +
        +
      1. Let select be option's option element nearest + ancestor select.

      2. + +
      3. +

        If all of the following conditions are true:

        + +
          +
        • select is not null;

        • + +
        • select does not have the multiple + attribute;

        • + +
        • option's selectedness + is true;

        • + +
        • select's enabled + selectedcontent is not null,

        • +
        + +

        then run clone an option into a selectedcontent given + option and select's enabled + selectedcontent.

        +
      4. +
      +
      option.selected
      @@ -56214,6 +56285,222 @@ interface HTMLLegendElement : HTMLElement { +

      The selectedcontent element

      + +
      +
      Categories:
      +
      None.
      +
      Contexts in which this element can be used:
      +
      As a descendant of a button element which is a child of a select + element.
      +
      Content model:
      +
      Nothing.
      +
      Content attributes:
      +
      Global attributes
      +
      Accessibility considerations:
      +
      For authors.
      +
      For implementers.
      +
      DOM interface:
      +
      +
      [Exposed=Window]
      +interface HTMLSelectedContentElement : HTMLElement {
      +  [HTMLConstructor] constructor();
      +};
      +
      +
      Uses HTMLSelectedContentElement.
      +
      + +

      The selectedcontent element reflects the contents of a select + element's currently selected option element. selectedcontent elements can + be used to declaratively show the selected option element's contents within the + select element's button element.

      + +

      Every time the selected option of a select switches from one + option to another, the selectedcontent element removes all of its children and + replaces them with a new cloned copy of the DOM structure of the select's selected + option element.

      + +

      selectedcontent elements become associated with a select element when + the selectedcontent is a descendant of the select's first + child button.

      + +

      Every selectedcontent element has a disabled state, which is a boolean, initially set to + false.

      + +

      To update a select's selectedcontent given a + select element select:

      + +
        +
      1. Let selectedcontent be the result of get a select's enabled + selectedcontent given select.

      2. + +
      3. If selectedcontent is null, then return.

      4. + +
      5. Let option be the first option in + select's list of + options whose selectedness is true, if + any such option exists, otherwise null.

      6. + +
      7. If option is null, then run clear a selectedcontent + given selectedcontent.

      8. + +
      9. Otherwise, run clone an option into a selectedcontent given + option and selectedcontent.

      10. +
      + +

      To get a select's enabled + selectedcontent given a select element select:

      + +
        +
      1. If select has the multiple + attribute, then return null.

      2. + +
      3. Let selectedcontent be the first selectedcontent element + descendant of select in tree order if any such element + exists; otherwise return null.

      4. + +
      5. If selectedcontent is disabled, + then return null.

      6. + +
      7. Return selectedcontent.

      8. +
      + +

      To clone an option into a selectedcontent, given an + option element option and a selectedcontent element + selectedcontent:

      + +
        +
      1. Let nodes be « ».

      2. + +
      3. +

        For each child of option's children:

        + +
          +
        1. Let childClone be the result of running clone given child, null, true.

        2. + +
        3. Append childClone to + nodes.

        4. +
        +
      4. + +
      5. Let documentFragment be the result of running convert nodes into a + node given nodes and option's node document.

      6. + +
      7. Ensure pre-insertion validity of documentFragment into + selectedContent before null.

      8. + +
      9. Replace all with + documentFragment within selectedcontent.

      10. +
      + +

      To clear a selectedcontent given a selectedcontent element + selectedcontent:

      + +
        +
      1. Remove all children of selectedcontent, in tree + order.

      2. +
      + +

      To clear a select's non-primary selectedcontent elements, + given a select element select:

      + +
        +
      1. Let passedFirstSelectedcontent be false.

      2. + +
      3. +

        For each descendant of select in tree order:

        + +
          +
        1. +

          If descendant is a selectedcontent element, then:

          + +
            +
          1. If passedFirstSelectedcontent is false, then set + passedFirstSelectedcontent to true.

          2. + +
          3. Otherwise, run clear a selectedcontent given + descendant.

          4. +
          +
        2. +
        +
      4. +
      + +

      The selectedcontent HTML element post-connection steps, given + selectedcontent, are:

      + +
        +
      1. Let nearestSelectAncestor be null.

      2. + +
      3. Let ancestor be selectedcontent's parent.

      4. + +
      5. Set selectedcontent's disabled + state to false.

      6. + +
      7. +

        For each ancestor of selectedcontent's ancestors in reverse tree order:

        + +
          +
        1. +

          If ancestor is a select element, then:

          + +
            +
          1. If nearestSelectAncestor is null, then set nearestSelectAncestor + to select.

          2. + +
          3. Otherwise, set selectedcontent's disabled state to true.

          4. +
          +
        2. + +
        3. If ancestor is an option element or a + selectedcontent element, then set selectedcontent's disabled state to true.

        4. +
        +
      8. + +
      9. If nearestSelectAncestor is null or nearestSelectAncestor has the + multiple attribute, then return.

      10. + +
      11. Run update a select's selectedcontent given + nearestSelectAncestor.

      12. + +
      13. Run clear a select's non-primary selectedcontent + elements given nearestSelectAncestor.

      14. +
      + +

      The selectedcontent HTML element removing steps, given + selectedcontent and oldParent, are:

      + +
        +
      1. +

        For each ancestor of selectedcontent's ancestors in reverse tree order:

        + +
          +
        1. If ancestor is a select element, then return.

        2. +
        +
      2. + +
      3. +

        For each ancestor of oldParent's inclusive ancestors in reverse tree order:

        + +
          +
        1. If ancestor is a select element, then run update a + select's selectedcontent given ancestor and + return.

        2. +
        +
      4. +
      +

      Form control infrastructure

      @@ -132170,9 +132457,18 @@ document.body.appendChild(text);
      An end tag whose tag name is "option"
      -

      If the current node is an option element, then pop that node from - the stack of open elements. Otherwise, this is a parse error; ignore - the token.

      +

      If the current node is an option element, then:

      + +
        +
      1. Let option be the current node.

      2. + +
      3. Pop option from the stack of open elements.

      4. + +
      5. Run maybe clone an option into selectedcontent given + option.

      6. +
      + +

      Otherwise, this is a parse error; ignore the token.

      An end tag whose tag name is "select"
      @@ -141236,6 +141532,16 @@ interface External { HTMLSelectElement + + selectedcontent + Mirrors content from an option + none + button + empty + globals + HTMLSelectedContentElement + + slot Shadow tree slot @@ -144039,6 +144345,10 @@ interface External { select HTMLSelectElement : HTMLElement + + selectedcontent + HTMLSelectedContentElement : HTMLElement + slot HTMLSlotElement : HTMLElement