diff --git a/source b/source index 9f6bfcc10b4..7f204ea3180 100644 --- a/source +++ b/source @@ -56410,7 +56410,7 @@ interface HTMLSelectElement : HTMLElement {
  • Run the selectedness setting algorithm given - selectElement.

  • + selectElement and false.

    @@ -56604,34 +56604,78 @@ interface HTMLSelectElement : HTMLElement {
    -

    If an option element in the list of - options asks for a reset, then run that - select element's selectedness setting algorithm.

    +

    To ask for a reset given an option element option:

    + +
      +
    1. If option's cached nearest ancestor select element is + null, then return.

    2. + +
    3. Run the selectedness setting algorithm given option's cached + nearest ancestor select element and false.

    4. +

    The selectedness setting algorithm, given a select element - element, is to run the following steps:

    - -
      -
    1. If element's multiple attribute is - absent, and element's display size is 1, - and no option elements in the element's list of options have their selectedness set to true, then set the selectedness of the first option - element in the list of options in - tree order that is not disabled, - if any, to true, and return.

    2. - -
    3. If element's multiple attribute is - absent, and two or more option elements in element's list of options have their selectedness set to true, then set the selectedness of all but the last option - element with its selectedness set to true in - the list of options in tree order - to false.

    4. + element and a boolean skipSelectedcontentUpdate, is to run the following + steps:

      + +
        +
      1. If element has the multiple attribute, + then return.

      2. + +
      3. Let updateSelectedcontent be false.

      4. + +
      5. Let firstEnabledOption be null.

      6. + +
      7. Let lastSelectedOption be null.

      8. + +
      9. +

        For each option of element's list of options:

        + +
          +
        1. +

          If option's selectedness is + true:

          + +
            +
          1. +

            If lastSelectedOption is not null:

            + +
              +
            1. Set lastSelectedOption's selectedness to false.

            2. + +
            3. Set updateSelectedcontent to true.

            4. +
            +
          2. + +
          3. Set lastSelectedOption to option.

          4. +
          +
        2. + +
        3. If firstEnabledOption is null and option is not disabled, then set firstEnabledOption to + option.

        4. +
        +
      10. + +
      11. +

        If lastSelectedOption is null and firstEnabledOption is not null and + element's display size is 1:

        + +
          +
        1. Set firstEnabledOption's selectedness to true.

        2. + +
        3. Set updateSelectedcontent to true.

        4. +
        +
      12. + +
      13. If updateSelectedcontent is true and skipSelectedcontentUpdate is + false, then run update a select's descendant selectedcontent + elements given element.

    @@ -56643,8 +56687,8 @@ interface HTMLSelectElement : HTMLElement {
    1. Set element's user validity to true.
    2. -
    3. Run update a select's selectedcontent given - element.

    4. +
    5. Run update a select's descendant selectedcontent + elements given element.

    6. Run clone selected option into select button given element.

    7. @@ -56880,8 +56924,8 @@ interface HTMLSelectElement : HTMLElement { firstMatchingOption's dirtiness to true.

      -
    8. Run update a select's selectedcontent given - this.

    9. +
    10. Run update a select's descendant selectedcontent + elements given this.

    @@ -56924,8 +56968,8 @@ interface HTMLSelectElement : HTMLElement { firstMatchingOption's dirtiness to true.

    -
  • Run update a select's selectedcontent given - this.

  • +
  • Run update a select's descendant selectedcontent + elements given this.

  • @@ -57489,20 +57533,20 @@ interface HTMLOptionElement : HTMLElement {
  • Let newSelect be option's option element nearest ancestor select.

  • +
  • Set option's cached nearest ancestor select + element to newSelect.

  • +
  • If oldSelect is not newSelect:

    1. If oldSelect is not null, then run the selectedness setting - algorithm given oldSelect.

    2. + algorithm given oldSelect and true.

    3. If newSelect is not null, then run the selectedness setting - algorithm given newSelect.

    4. + algorithm given newSelect and true.

  • - -
  • Set option's cached nearest ancestor select - element to newSelect.

  • @@ -57512,11 +57556,36 @@ interface HTMLOptionElement : HTMLElement { select given insertedOption.

    +
    +

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

    + +
      +
    1. If insertedOption's cached nearest ancestor select + element is not null and insertedOption is selected, then update a select's + descendant selectedcontent elements given insertedOption's + cached nearest ancestor select element.

    2. +
    +
    +

    The option HTML element removing steps, given - removedNode, isSubtreeRoot, and oldAncestor are to run - update an option's nearest ancestor select given - removedNode.

    + removedNode, isSubtreeRoot, and oldAncestor, are:

    + +
      +
    1. Let select be removedNode's cached nearest ancestor + select element.

    2. + +
    3. If removedNode is selected + and select is not null and select has at least one descendant + selectedcontent element, then queue a microtask to update a + select's descendant selectedcontent elements given + select.

    4. + +
    5. Update an option's nearest ancestor select given + removedNode.

    6. +
    @@ -57560,34 +57629,6 @@ interface HTMLOptionElement : HTMLElement {
    -
    -

    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;

      • - -
      • option's selectedness is - true; and

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

      • -
      - -

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

      -
    4. -
    -
    -

    To clone selected option into select button, given a select element select:

    @@ -57609,9 +57650,21 @@ interface HTMLOptionElement : HTMLElement {
    -

    When an option element is popped off the stack of open elements of an - HTML parser or XML parser, the user agent must run maybe clone an - option into selectedcontent given the option element.

    +

    When an option element option is popped off the stack of open + elements of an HTML parser or XML parser:

    + +
      +
    1. If option is not selected, + then return.

    2. + +
    3. Let select be option's option element nearest + ancestor select.

    4. + +
    5. If select is null, then return.

    6. + +
    7. Update a select's descendant selectedcontent + elements given select.

    8. +
    @@ -59429,45 +59482,43 @@ interface HTMLSelectedContentElement : HTMLElementdisabled, which is initially false.

    -

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

    +

    To update a select's descendant selectedcontent elements + 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. If select has the multiple + attribute, then return.

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

    8. +
    9. Let descendantSelectedcontents be select's descendant + selectedcontent elements which are not disabled, in tree order.

    10. -
    11. If option is null, then run clear a selectedcontent - given selectedcontent.

    12. +
    13. +

      For each selectedcontent of descendantSelectedcontents:

      -
    14. Otherwise, run clone an option into a selectedcontent given - option and selectedcontent.

    15. +
        +
      1. Update a selectedcontent given select and + selectedcontent.

      2. +
      +
    -

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

    +

    To update a selectedcontent given a select element + select and a selectedcontent element selectedcontent:

      -
    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. 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 selectedcontent's disabled is - true, then return null.

    8. +
    9. If option is null, then run clear a selectedcontent + given selectedcontent.

    10. -
    11. Return selectedcontent.

    12. +
    13. Otherwise, run clone an option into a selectedcontent given + option and selectedcontent.

    @@ -59477,6 +59528,9 @@ interface HTMLSelectedContentElement : HTMLElementselectedcontent:

      +
    1. If selectedcontent's disabled is + true, then return.

    2. +
    3. Let documentFragment be a new DocumentFragment whose node document is option's node document.

    4. @@ -59504,36 +59558,16 @@ interface HTMLSelectedContentElement : HTMLElementselectedcontent:

        +
      1. If selectedcontent's disabled is + true, then return.

      2. +
      3. Replace all with null within selectedcontent.

      -

      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's descendants in tree order that is a - selectedcontent element:

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

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

        4. -
        -
      4. -
      -
      - -
      -

      The selectedcontent HTML element post-connection steps, given +

      The selectedcontent HTML element insertion steps, given selectedcontent, are:

        @@ -59552,7 +59586,7 @@ interface HTMLSelectedContentElement : HTMLElement
      1. If nearestSelectAncestor is null, then set nearestSelectAncestor - to select and continue.

      2. + to ancestor and continue.

      3. Set selectedcontent's disabled to true and break.

      4. @@ -59564,46 +59598,38 @@ interface HTMLSelectedContentElement : HTMLElementdisabled to true and break.

      - -
    5. If selectedcontent's disabled is - true, nearestSelectAncestor is null, or nearestSelectAncestor has the - multiple attribute, then return.

    6. - -
    7. Run update a select's selectedcontent given - nearestSelectAncestor.

    8. - -
    9. Run clear a select's non-primary selectedcontent - elements given nearestSelectAncestor.

    -

    The selectedcontent HTML element removing steps, given - removedNode, isSubtreeRoot, and oldAncestor are:

    +

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

      -
    1. If removedNode's disabled is - true, then return.

    2. +
    3. Let nearestSelectAncestor be null.

    4. -

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

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

      2. +
      3. +

        If ancestor is a select element:

        + +
          +
        1. If nearestSelectAncestor is null, then set nearestSelectAncestor + to ancestor and break.

        2. +
        +
    5. -
    6. -

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

      +
    7. If selectedcontent's disabled is + true, nearestSelectAncestor is null, or nearestSelectAncestor has the + multiple attribute, then return.

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

      2. -
      - +
    9. Update a selectedcontent given nearestSelectAncestor + and selectedcontent.