diff --git a/source b/source index de407dd6dc0..034ff0f69af 100644 --- a/source +++ b/source @@ -1796,6 +1796,22 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute node document.

+

The post-connection steps for the HTML + Standard, given insertedNode, are defined as the following:

+ +
    +
  1. +

    For each descendant of insertedNode's inclusive descendants in tree order:

    + +
      +
    1. If descendant is a selectedoption element, then run the + selectedoption insertion steps given descendant and + insertedNode's parent.

    2. +
    +
  2. +
+

The removing steps for the HTML Standard, given removedNode and oldParent, are defined as the following:

@@ -1838,6 +1854,20 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
  • If removedNode's popover attribute is not in the no popover state, then run the hide popover algorithm given removedNode, false, false, and false.

  • + +
  • +

    For each descendant of removedNode's inclusive descendants in tree order:

    + +
      +
    1. If descendant is an option element, then run the option + removal steps given descendant and oldParent.

    2. + +
    3. If descendant is a selectedoption element, then run the + selectedoption removal steps given descendant and + oldParent.

    4. +
    +
  • A id attribute

  • setAttribute() method
  • textContent attribute
  • +
  • replaceChildren() method
  • The tree, shadow tree, and node tree concepts
  • The tree order and shadow-including tree order concepts
  • @@ -3208,12 +3239,14 @@ 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, shadow-including inclusive descendant, and shadow-including inclusive ancestor concepts
  • The first child, + last child, next sibling, previous sibling, and parent concepts
  • @@ -3234,6 +3267,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
  • The descendant concept
  • The insertion steps, removing steps, + post-connection steps, adopting steps, and children changed steps hooks for elements
  • The change, append, remove, replace, get an attribute by namespace and local name, set value, and remove an attribute by namespace and local name algorithms for attributes
  • @@ -3953,6 +3987,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
  • The concept widget
  • The concept native appearance
  • The concept primitive appearance
  • +
  • The concept base appearance
  • The concept element with default preferred size
  • The non-devolvable widget and devolvable widget classification, and the related @@ -4153,6 +4188,12 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
  • 'content-visibility' property
  • 'auto' value for 'content-visibility'
  • + +

    The following terms are defined in CSS Anchor Positioning: CSSANCHOR

    + + @@ -12785,6 +12826,34 @@ https://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20HTML%3E% +
    Select element inner content elements
    + +

    Select element inner content elements are option elements and other + elements which are used to group and decorate them with a select element.

    + +

    The following are select element inner content elements:

    + + + +
    Transparent content models
    @@ -53096,6 +53165,10 @@ interface HTMLButtonElement : HTMLElement {
  • If element's node document is not fully active, then return.

  • +
  • If element's parent is a select element, then + show the picker, if applicable given element's parent and + return.

  • +
  • If element has a form owner then switch on element's type attribute's state, then:

    @@ -53203,7 +53276,8 @@ interface HTMLButtonElement : HTMLElement {
    Contexts in which this element can be used:
    Where phrasing content is expected.
    Content model:
    -
    Zero or more option, optgroup, hr, and script-supporting elements.
    +
    Zero or more select element inner content elements.
    +
    Zero or one child button.
    Content attributes:
    Global attributes
    autocomplete
    @@ -53261,6 +53335,8 @@ interface HTMLSelectElement : HTMLElement { undefined showPicker(); readonly attribute NodeList labels; + + attribute HTMLSelectedOptionElement? selectedOptionElement; };
    Uses HTMLSelectElement.
    @@ -53299,10 +53375,43 @@ interface HTMLSelectElement : HTMLElement { -

    The list of options for a select - element consists of all the option element children of the select - element, and all the option element children of all the optgroup element - children of the select element, in tree order.

    +

    To get the list of options given a + select element select:

    + +
      +
    1. Let options be « ».

    2. + +
    3. +

      For each node of select's + descendants in tree order except the descendants + which are select elements and their subtrees:

      + +
        +
      1. If node is an option element, then append node to options.

      2. +
      +
    4. + +
    5. Return options.

    6. +
    + +

    Every select element has select descendant selectedoption elements, + which is a list of selectedoption elements, initially « ».

    + +

    To get the select target selectedoption elements, given a select + select:

    + +
      +
    1. Let selectedoptions be select's select descendant + selectedoption elements.

    2. + + +
    3. Append the value of select's selectedOptionElement, if it is non-null.

    4. + +
    5. Return selectedoptions.

    6. +

    The required attribute is a boolean attribute. When specified, the user will be required to select @@ -53350,10 +53459,23 @@ interface HTMLSelectElement : HTMLElement { through a click, or through unfocusing the element after changing its value, or through a menu command, or through any other mechanism), and before the relevant user interaction event is queued (e.g. before the - click event), the user agent must set the selectedness of the picked option element - to true, set its dirtiness to true, and then - send select update notifications.

    + click event), the user agent must run the following steps given + the select select and the picked option + option:

    + +
      +
    1. Set the selectedness of + option to true.

    2. + +
    3. Set the dirtiness of option to + true.

    4. + +
    5. Send select update notifications.

    6. + +
    7. For each selectedoption in select's select target + selectedoption elements, run clone an option into a selectedoption given + option and selectedoption.

    8. +

    If the multiple attribute is absent, whenever an option element in the select element's HTMLSelectElement : HTMLElement {

    1. If element's multiple attribute is - absent, and element's display size is 1, - and no option elements in the element's

    2. + +
    3. If 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.

    4. + data-x="concept-option-selectedness">selectedness of the first option element + in the list of options in tree + order that is not disabled, if any, to true, + and return.

      -
    5. If element's multiple attribute is - absent, and two or more option elements in element's

      If 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.

    6. -
    -

    The option HTML element insertion - steps, given insertedNode, are:

    +
  • Let option be the first option in element's list of options which has its selectedness set to true, or null if there is no such + option.

  • -
      -
    1. If insertedNode's parent is a select element, or - insertedNode's parent is an optgroup element whose parent is a - select element, then run that select element's selectedness - setting algorithm.

    2. -
    - -

    The option HTML element removing - steps, given removedNode and oldParent, are:

    - -
      -
    1. If oldParent is a select element, or oldParent is an - optgroup element whose parent is a select element, then run that - select element's selectedness setting algorithm.

    2. -
    - -

    The optgroup HTML element removing - steps, given removedNode and oldParent, are:

    - -
      -
    1. If oldParent is a select element and removedNode has an - option child, then run oldParent's selectedness setting - algorithm.

    2. +
    3. For each selectedoption in element's select target + selectedoption elements, run clone an option into a selectedoption given + option and selectedoption.

    If an option element in the list of @@ -53692,14 +53796,27 @@ 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. Let option be the first option element in the list of options in tree order whose value is equal to the new given value, otherwise + null.

    4. + +
    5. If option is not null, then set option's selectedness to true and its dirtiness to true. + +

    6. For each selectedoption in select's select target + selectedoption elements, run clone an option into a selectedoption given + option and selectedoption.

    7. +

    This can result in no element having a selectedness set to true even in the case of the @@ -53819,6 +53936,64 @@ interface HTMLSelectElement : HTMLElement { … +

    The selectedoptionelement attribute

    + +

    select elements may have the selectedoptionelement + attribute. When specified its value must be the ID of a + selectedoption element in the same tree as the select with + the selectedoptionelement attribute. The target + selectedoption will update its contents to match the currently selected + option of the select.

    + +
    +

    The following code shows how the selectedoptionelement attribute can be used to render + a select element's value outside of the select:

    + +
    <label for="pet-select">Choose a pet:</label>
    +<select id="pet-select" selectedoptionelement="summary-value">
    +  <option>dog</option>
    +  <option>cat</option>
    +</select>
    +<p>Summary: you chose the <selectedoption id="summary-value"></selectedoption>.<p>
    +
    + +

    The selectedOptionElement IDL attribute must + reflect the selectedoptionelement + attribute, limited to only known values.

    + +

    The following attribute change + steps given element, localName, oldValue, + value, and namespace, are used for select elements:

    + +
      +
    1. If namespace is not null, then return.

    2. + +
    3. If localName is not selectedoptionelement, then return.

    4. + +
    5. Let oldSelectedoption be the first selectedoption element in + tree order in element's root whose ID is oldValue if one exists, otherwise null.

    6. + +
    7. Let newSelectedoption be the first selectedoption element in + tree order in element's root whose ID is value if one exists, otherwise null.

    8. + +
    9. If oldSelectedoption is eequal to newSelectedoption, then + return.

    10. + +
    11. If oldSelectedoption is not null, then run clone an option into a + selectedoption given null and oldSelectedOption.

    12. + +
    13. If newSelectedoption is not null, then run clone an option into a + selectedoption given the value of element's selectedOptionElement and + newSelectedOption.

    14. +
    +

    The datalist element

    @@ -53932,9 +54107,10 @@ interface HTMLDataListElement : HTMLElement {
    Categories:
    None.
    Contexts in which this element can be used:
    -
    As a child of a select element.
    +
    As a descendant of a select element.
    Content model:
    -
    Zero or more option and script-supporting elements.
    +
    Zero or more select element inner content elements.
    +
    Zero or one legend elements.
    Content attributes:
    Global attributes
    disabled
    @@ -54029,17 +54205,15 @@ interface HTMLOptGroupElement : HTMLElement {
    Categories:
    None.
    Contexts in which this element can be used:
    -
    As a child of a select element.
    +
    As a descendant of a select element.
    As a child of a datalist element.
    -
    As a child of an optgroup element.
    +
    As a descendant of an optgroup element.
    Content model:
    If the element has a label attribute and a value attribute: Nothing.
    If the element has a label attribute but no value attribute: Text.
    -
    If the element has no label attribute and is not a - child of a datalist element: Text that is not - inter-element whitespace.
    -
    If the element has no label attribute and is a child - of a datalist element: Text.
    +
    If the element has no label attribute: Text content and zero or more div, span, noscript, img, SVG svg, and script-supporting elements.
    +
    If an img is used within an option and there is no other text within the option, then the option won't have an accessible name unless the img also has a non-empty alt attribute.
    +
    Content attributes:
    Global attributes
    disabled
    @@ -54156,6 +54330,138 @@ interface HTMLOptionElement : HTMLElement { +

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

    + +
      +
    1. +

      For each ancestor of option's ancestors:

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

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

    4. +
    + +

    To maybe clone option into select button, given an Element + element:

    + +
      +
    1. +

      For each ancestor of element's ancestors:

      + +
        +
      1. +

        If all of the following conditions are true:

        + +
          +
        • ancestor is an option element;

        • + +
        • ancestor has a non-null option element ancestor + select;

        • + +
        • ancestor's option element ancestor select is rendered as a + drop-down box;

        • + +
        • ancestor's selectedness + is true,

        • +
        + +

        then run clone selected option text into select given ancestor.

        +
      2. +
      +
    2. +
    + +

    To clone selected option text into select given an option element + selectedOption:

    + +
      +
    1. Assert: selectedOption's selectedness is true.

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

    4. + +
    5. Assert: select is not null.

    6. + +
    7. Set select's select fallback button text to the value of + selectedOption's label.

    8. + +
    9. +

      For each selectedoption of select's select target + selectedoption elements:

      + +
        +
      1. Run clone an option into a selectedoption given option and + selectedoption.

      2. +
      +
    10. +
    + +

    The option HTML element insertion steps, given + insertedOption, are:

    + +
      +
    1. +

      For each ancestor of option's ancestors:

      + +
        +
      1. If ancestor is a select element, then run the selectedness + setting algorithm given select and return.

      2. +
      +
    2. +
    + +

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

    + +
      +
    1. +

      For each ancestor of oldParent's inclusive ancestors:

      + +
        +
      1. If ancestor is a select element, then run the selectedness + setting algorithm given select and return.

      2. +
      +
    + +

    The activation behavior of an option option is to run the + following steps:

    + +
      +
    1. Let select be the option element ancestor select given + option.

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

    4. + +
    5. Set option's selectedness to + true.

    6. + +
    7. Set option's dirtiness to + true.

    8. + +
    9. Send select update notifications given + select.

    10. + +
    11. +

      If select is being rendered as a drop-down box with base + appearance:

      + +
        +
      1. Run the hide popover algorithm given the first item in select's + select popover slot's assigned nodes.

      2. +
      +
    12. +
    +
    option.selected
    @@ -55816,6 +56122,115 @@ interface HTMLLegendElement : HTMLElement { +

    The selectedoption element

    + +

    The selectedoption element reflects the contents of a select + element's currently selected option element. selectedoption elements can + be used to declaratively show the selected option element's contents in a different + part of the document, such as the select element's invoker button, with alternate + rendering based on different selectors in the author's stylesheet.

    + +

    Every time the selected option of a select switches from one option + to another, or the currently selected option's descendant DOM structure mutates, the + selectedoption 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.

    + +

    selectedoption elements become associated with select elements when + the selectedoption is a descendant of the select.

    + + + +

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

    + +
      +
    1. Let nodes be « ».

    2. + +
    3. +

      If option is not null, then 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. Run replaceChildren on + selectedOption given nodes.

    6. +
    + +

    The selectedoption insertion steps, given selectedoption and + insertionPoint, are:

    + +
      +
    1. Let firstAncestorSelect be null.

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

    4. + +
    5. +

      While firstAncestorSelect is null and ancestor is not + null:

      + +
        +
      1. If ancestor is a select element, then set + firstAncestorSelect to ancestor.

      2. + +
      3. Set ancestor to ancestor's parent.

      4. +
      +
    6. + +
    7. If firstAncestorSelect is null, then return.

    8. + +
    9. Append selectedoption to + firstAncestorSelect's select descendant selectedoption elements.

    10. + +
    11. Run clone an option into a selectedoption given the first option + in firstAncestorSelect's list of + options whose selectedness is true and + insertedNode.

    12. +
    + +

    The selectedoption removal steps, given selectedoption and + oldParent, are:

    + +
      +
    1. +

      For each ancestor of selectedoption's ancestors:

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

      2. +
      +
    2. + +
    3. +

      For each ancestor of oldParent's inclusive ancestors:

      + +
        +
      1. +

        If ancestor is a select element, then:

        + +
          +
        1. remove selectedoption from + ancestor's select descendant selectedoption elements.

        2. + +
        3. Run clone an option into a selectedoption given null and + selectedoption.

        4. + +
        5. Return.

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

    Form control infrastructure

    @@ -124353,25 +124768,22 @@ dictionary StorageEventInit : EventInit { caption">in caption", "in column group", "in table body", "in row", "in - cell", "in select", "in select in table", "in template", "after body", - "in frameset", "after frameset", "after - after body", and "after after - frameset" during the course of the parsing, as described in the tree - construction stage. The insertion mode affects how tokens are processed and whether CDATA - sections are supported.

    + cell", "in template", "after body", "in frameset", "after + frameset", "after after body", and + "after after frameset" during the + course of the parsing, as described in the tree construction stage. The insertion + mode affects how tokens are processed and whether CDATA sections are supported.

    Several of these modes, namely "in head", "in body", "in - table", and "in select", are special, in - that the other modes defer to them at various times. When the algorithm below says that the user - agent is to do something "using the rules for the m insertion - mode", where m is one of these modes, the user agent must use the rules - described under the m insertion mode's section, but must leave - the insertion mode unchanged unless the rules in m themselves - switch the insertion mode to a new value.

    + data-x="insertion mode: in body">in body", and "in + table", are special, in that the other modes defer to them at various times. When the + algorithm below says that the user agent is to do something "using the rules for the + m insertion mode", where m is one of these modes, the user agent must use + the rules described under the m insertion mode's section, but must leave + the insertion mode unchanged unless the rules in m themselves switch the + insertion mode to a new value.

    When the insertion mode is switched to "text" or "in table text", the original insertion @@ -124402,37 +124814,6 @@ dictionary StorageEventInit : EventInit { parsing algorithm (fragment case), set node to the context element passed to that algorithm.

    -
  • -

    If node is a select element, run these substeps:

    - -
      -
    1. If last is true, jump to the step below labeled - done.

    2. - -
    3. Let ancestor be node.

    4. - -
    5. Loop: If ancestor is the first node in the stack of - open elements, jump to the step below labeled done.

    6. - -
    7. Let ancestor be the node before ancestor in the - stack of open elements.

    8. - -
    9. If ancestor is a template node, jump to the step below - labeled done.

    10. - -
    11. If ancestor is a table node, switch the insertion - mode to "in select in table" - and return.

    12. - -
    13. Jump back to the step labeled loop.

    14. - -
    15. Done: Switch the insertion mode to "in select" and return.

    16. -
    -
  • -
  • If node is a td or th element and last is false, then switch the insertion mode to "in cell" and return.

  • @@ -124631,6 +125012,7 @@ dictionary StorageEventInit : EventInit {
  • th
  • marquee
  • object
  • +
  • select
  • template
  • MathML mi
  • MathML mo
  • @@ -124677,17 +125059,6 @@ dictionary StorageEventInit : EventInit {
  • template in the HTML namespace
  • -

    The stack of open elements is said to have a particular element in select scope when it has that element in the specific scope consisting of all element types - except the following:

    - - -

    Nothing happens if at any time any of the elements in the stack of open elements are moved to a new location in, or removed from, the Document tree. In particular, the stack is not changed in this situation. This can cause, amongst other strange effects, content @@ -129324,6 +129695,24 @@ document.body.appendChild(text); p element in button scope, then close a p element.

    +

    If the stack of open elements has a + select element in scope and has either an option element in scope or an optgroup element in scope, then:

    + +
      +
    1. Generate implied end tags except for option and + optgroup elements.

    2. + +
    3. If the current node is not now an option or + optgroup element, this is a parse error.

    4. + +
    5. While the stack of open elements has + an option element in scope or has an + optgroup element in scope, pop an element from the stack of open + elements.

    6. +
    +

    Insert an HTML element for the token. Immediately pop the current node off the stack of open elements.

    @@ -129393,25 +129782,70 @@ document.body.appendChild(text);
    A start tag whose tag name is "select"
    +

    If the stack of open elements has a + select element in scope, then:

    + +
      +
    1. Parse error.

    2. + +
    3. Pop elements from the stack of open elements until a select + element has been popped from the stack.

    4. +
    +

    Reconstruct the active formatting elements, if any.

    Insert an HTML element for the token.

    Set the frameset-ok flag to "not ok".

    +
    + +
    A start tag whose tag name is "option"
    +
    +

    If the stack of open elements has a + select element in scope and has a has + an option element in scope, then:

    + +
      +
    1. Generate implied end tags except for option elements.

    2. -

      If the insertion mode is one of "in - table", "in caption", "in table body", "in row", or "in cell", then switch the - insertion mode to "in select in - table". Otherwise, switch the insertion mode to "in select".

      +
    3. If the current node is not now an option element, this is a + parse error.

    4. + +
    5. While the stack of open elements has + an option element in scope, pop an element from the stack of open + elements.

    6. +
    + +

    Reconstruct the active formatting elements, if any.

    + +

    Insert an HTML element for the token.

    -
    A start tag whose tag name is one of: "optgroup", "option"
    +
    A start tag whose tag name is "optgroup"
    -

    If the current node is an option element, then pop the - current node off the stack of open elements.

    +

    If the stack of open elements has a + select element in scope and has either an option element in scope or an optgroup element in scope, then:

    + +
      +
    1. Generate implied end tags except for option and + optgroup elements.

    2. + +
    3. If the current node is not now an option or + optgroup element, this is a parse error.

    4. + +
    5. Generate implied end tags except for optgroup + elements.

    6. + +
    7. If the current node is not now an optgroup element, this is a + parse error.

    8. + +
    9. While the stack of open elements has + an option element in scope or has an + optgroup element in scope, pop an element from the stack of open + elements.

    10. +

    Reconstruct the active formatting elements, if any.

    @@ -130539,231 +130973,6 @@ document.body.appendChild(text); same time, nor can it have neither when the close the cell algorithm is invoked.

    -
    The "in select" insertion mode
    - -

    When the user agent is to apply the rules for the "in - select" insertion mode, the user agent must handle the token as follows:

    - -
    - -
    A character token that is U+0000 NULL
    -
    -

    Parse error. Ignore the token.

    -
    - -
    Any other character token
    -
    -

    Insert the token's character.

    -
    - -
    A comment token
    -
    -

    Insert a comment.

    -
    - -
    A DOCTYPE token
    -
    -

    Parse error. Ignore the token.

    -
    - -
    A start tag whose tag name is "html"
    -
    -

    Process the token using the rules for the "in body" insertion mode.

    -
    - -
    A start tag whose tag name is "option"
    -
    - -

    If the current node is an option element, pop that node from the - stack of open elements.

    - - -

    Insert an HTML element for the token.

    -
    - -
    A start tag whose tag name is "optgroup"
    -
    - -

    If the current node is an option element, pop that node from the - stack of open elements.

    - - - -

    If the current node is an optgroup element, pop that node from the - stack of open elements.

    - - -

    Insert an HTML element for the token.

    -
    - -
    A start tag whose tag name is "hr"
    -
    - -

    If the current node is an option element, pop that node from the - stack of open elements.

    - - - -

    If the current node is an optgroup element, pop that node from the - stack of open elements.

    - - -

    Insert an HTML element for the token. Immediately pop the current - node off the stack of open elements.

    - -

    Acknowledge the token's self-closing flag, if it is set.

    -
    - -
    An end tag whose tag name is "optgroup"
    -
    - -

    First, if the current node is an option element, and the node - immediately before it in the stack of open elements is an optgroup - element, then pop the current node from the stack of open - elements.

    - - -

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

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

    -
    - -
    An end tag whose tag name is "select"
    -
    -

    If the stack of open elements does not have a select element in select scope, this is a parse - error; ignore the token. (fragment case)

    - -

    Otherwise:

    - -

    Pop elements from the stack of open elements until a select element - has been popped from the stack.

    - -

    Reset the insertion mode appropriately.

    -
    - -
    A start tag whose tag name is "select"
    -
    -

    Parse error.

    - - -

    If the stack of open elements does not have a select element in select scope, ignore the token. - (fragment case)

    - -

    Otherwise:

    - -

    Pop elements from the stack of open elements until a select element - has been popped from the stack.

    - -

    Reset the insertion mode appropriately.

    - - -

    It just gets treated like an end tag.

    -
    - -
    A start tag whose tag name is one of: "input", "keygen", "textarea"
    -
    -

    Parse error.

    - - -

    If the stack of open elements does not have a select element in select scope, ignore the token. - (fragment case)

    - -

    Otherwise:

    - -

    Pop elements from the stack of open elements until a select element - has been popped from the stack.

    - -

    Reset the insertion mode appropriately.

    - - -

    Reprocess the token.

    -
    - -
    A start tag whose tag name is one of: "script", "template"
    -
    An end tag whose tag name is "template"
    -
    -

    Process the token using the rules for the "in head" insertion mode.

    -
    - -
    An end-of-file token
    -
    -

    Process the token using the rules for the "in body" insertion mode.

    -
    - -
    Anything else
    -
    -

    Parse error. Ignore the token.

    -
    -
    - - -
    The "in select in table" insertion mode
    - -

    When the user agent is to apply the rules for the "in select in table" insertion mode, the user agent must handle the - token as follows:

    - -
    - -
    A start tag whose tag name is one of: "caption", "table", "tbody", "tfoot", "thead", "tr", - "td", "th"
    -
    -

    Parse error.

    - - -

    Pop elements from the stack of open elements until a select element - has been popped from the stack.

    - -

    Reset the insertion mode appropriately.

    - - -

    Reprocess the token.

    -
    - -
    An end tag whose tag name is one of: "caption", "table", "tbody", "tfoot", "thead", "tr", - "td", "th"
    -
    -

    Parse error.

    - -

    If the stack of open elements does not have an element in table scope that is an HTML - element with the same tag name as that of the token, then ignore the token.

    - -

    Otherwise:

    - - -

    Pop elements from the stack of open elements until a select element - has been popped from the stack.

    - -

    Reset the insertion mode appropriately.

    - - -

    Reprocess the token.

    -
    - -
    Anything else
    -
    -

    Process the token using the rules for the "in select" insertion mode.

    -
    -
    - - -
    The "in template" insertion mode

    When the user agent is to apply the rules for the "in @@ -135678,12 +135887,98 @@ progress { appearance: auto; } with the element's optgroup element children providing headers for groups of options where applicable.

    + + +

    select elements which render as a drop-down box support a base + appearance in addition to native appearance and primitive + appearance.

    + +

    When a select is being rendered as a drop-down box with a base + appearance, it is expected to render as if it has the following shadow + root:

    + +
    <slot id="select-button-slot">
    +  <div id="select-fallback-button-text"></div>
    +</slot>
    +<div id="select-popover" popover="auto">
    +  <slot id="select-popover-slot"></slot>
    +</div>
    + +

    Since base appearance is determined by computing style, it isn't + possible to swap this DOM structure when switching appearance. Implementations can always include + the DOM structure for base appearance when the select is rendered as a + drop-down box and then choose to include or exclude it from the layout tree in order + to control whether it gets rendered or not.

    + +

    select elements rendered as a drop-down box with base + appearance each contain the following elements as shown with ID attributes in the above + HTML:

    + + + + +

    The implicit anchor element of the select popover element is the + select element shadow host of the shadow host in which select popover + resides.

    + +

    The shadow root used for select's drop-down box + base appearance must have its slot assignment set to "manual". The shadow root must also have delegates focus + set to true if select button slot has an assigned node.

    + +

    Without delegates focus set to true, the select itself + would receive focus instead of the button which is slotted into the select + button slot.

    + +

    select elements rendered as a drop-down box with base + appearance must render as if they are using manual slot assignment with the + following base select slotting algorithm to assign + their child nodes to slots. To perform the base select slotting algorithm, given a + select element select:

    + +
      +
    1. Let firstButton be null.

    2. + +
    3. Let otherChildren be « ».

    4. + +
    5. +

      For each Node child in + select's children:

      + +
        +
      1. If child is a button and firstButton is null, then set + firstButton to child.

      2. + +
      3. Otherwise, append child to + otherChildren.

      4. +
      +
    6. + +
    7. Set select's select button slot's manually assigned + nodes to firstButton.

    8. + +
    9. Set select's select popover slot's manually assigned + nodes to otherChildren.

    10. +
    +

    An optgroup element is expected to be rendered by displaying the element's label attribute.

    An option element is expected to be rendered by displaying the element's label, indented under its optgroup element if it - has one.

    + has one. If the option is being rendered in a select which is being + rendered as a drop-down box with base appearance, then the + option is expected to render all of its children rather than by displaying its label.

    Each sequence of one or more child hr element siblings may be rendered as a single separator.

    @@ -135710,6 +136005,184 @@ progress { appearance: auto; } + + + + +

    The following styles are expected to apply to select elements when they are being + rendered as a drop-down box with base appearance:

    + +
    @namespace "http://www.w3.org/1999/xhtml";
    +
    +select {
    +  background-color: transparent;
    +  border: 0px none transparent;
    +
    +select > datalist,
    +select::select-fallback-datalist {
    +  box-shadow: 0px 12.8px 28.8px rgba(0, 0, 0, 0.13), 0px 0px 9.2px rgba(0, 0, 0, 0.11);
    +  box-sizing: border-box;
    +  overflow: auto;
    +  border: 1px solid rgba(0, 0, 0, 0.15);
    +  border-radius: 0.25em;
    +  padding-block: 0.25em;
    +  padding-inline: 0;
    +  background-color: Field;
    +  margin: 0;
    +  inset: auto;
    +  min-inline-size: anchor-size(self-inline);
    +  min-block-size: 1lh;
    +  inset-block-start: anchor(self-end);
    +  inset-inline-start: anchor(self-start);
    +  position-try:
    +    -internal-select-datalist-reverse-block,
    +    -internal-select-datalist-reverse-inline,
    +    -internal-select-datalist-reverse-both,
    +    -internal-select-datalist-default-fill,
    +    -internal-select-datalist-reverse-block-fill,
    +    -internal-select-datalist-reverse-inline-fill,
    +    -internal-select-datalist-reverse-both-fill;
    +}
    +
    +/* Fallbacks without vertical scrolling */
    +@position-try -internal-select-fallback-datalist-reverse-block {
    +  inset: auto;
    +  /* Reverse block axis */
    +  inset-block-end: anchor(self-start);
    +  inset-inline-start: anchor(self-start);
    +}
    +@position-try -internal-select-fallback-datalist-reverse-inline {
    +  inset: auto;
    +  /* Reverse inline axis */
    +  inset-block-start: anchor(self-end);
    +  inset-inline-end: anchor(self-end);
    +}
    +@position-try -internal-select-fallback-datalist-reverse-both {
    +  inset: auto;
    +  /* Reverse both axes */
    +  inset-block-end: anchor(self-start);
    +  inset-inline-end: anchor(self-end);
    +}
    +
    +/* Fallbacks with vertical scrolling */
    +@position-try -internal-select-fallback-datalist-default-fill {
    +  inset: auto;
    +  inset-block-start: anchor(self-end);
    +  inset-inline-start: anchor(self-start);
    +  block-size: -webkit-fill-available;
    +}
    +@position-try -internal-select-fallback-datalist-reverse-block-fill {
    +  inset: auto;
    +  /* Reverse block axis */
    +  inset-block-end: anchor(self-start);
    +  inset-inline-start: anchor(self-start);
    +  block-size: -webkit-fill-available;
    +}
    +@position-try -internal-select-fallback-datalist-reverse-inline-fill {
    +  inset: auto;
    +  /* Reverse inline axis */
    +  inset-block-start: anchor(self-end);
    +  inset-inline-end: anchor(self-end);
    +  block-size: -webkit-fill-available;
    +}
    +@position-try -internal-select-fallback-datalist-reverse-both-fill {
    +  inset: auto;
    +  /* Reverse both axes */
    +  inset-block-end: anchor(self-start);
    +  inset-inline-end: anchor(self-end);
    +  block-size: -webkit-fill-available;
    +}
    +
    +select > datalist,
    +select::select-fallback-datalist {
    +  position: fixed;
    +  width: fit-content;
    +  height: fit-content;
    +  color: CanvasText;
    +}
    +select > datalist:popover-open,
    +select::select-fallback-datalist:popover-open {
    +  overlay: auto !important;
    +  display: block;
    +}
    +select > datalist:-internal-popover-in-top-layer::backdrop,
    +select::select-fallback-datalist:-internal-popover-in-top-layer::backdrop {
    +  position: fixed;
    +  inset: 0;
    +  pointer-events: none !important;
    +  background-color: transparent;
    +}
    +
    +select:open > datalist {
    +  display: block;
    +}
    +
    +select::select-fallback-button {
    +  color: FieldText;
    +  background-color: Field;
    +  appearance: none;
    +  padding: 0.25em;
    +  border: 1px solid ButtonBorder;
    +  cursor: default;
    +  font-size: inherit;
    +  text-align: inherit;
    +  display: inline-flex;
    +  flex-grow: 1;
    +  flex-shrink: 1;
    +  align-items: center;
    +  overflow-x: hidden;
    +  overflow-y: hidden;
    +}
    +
    +select::select-fallback-button-icon {
    +  opacity: 1;
    +  outline: none;
    +  margin-inline-start: 0.25em;
    +  padding-block: 2px;
    +  padding-inline: 3px;
    +  block-size: 1.0em;
    +  inline-size: 1.2em;
    +  min-inline-size: 1.2em;
    +  max-inline-size: 1.2em;
    +  display: block;
    +
    +  color: light-dark(black, white);
    +  stroke: currentColor;
    +  stroke-width: 3;
    +  stroke-linejoin: round;
    +}
    +
    +select::select-fallback-button-text {
    +  color: inherit;
    +  min-inline-size: 0px;
    +  max-block-size: 100%;
    +  flex-grow: 1;
    +  flex-shrink: 1;
    +  overflow: hidden;
    +  display: inline;
    +}
    +
    +select option:not(:disabled):hover {
    +  background-color: SelectedItem;
    +  color: SelectedItemText;
    +}
    +
    +select option {
    +  /* min-size rules ensure that we meet accessibility guidelines for minimum target size.
    +   * https://www.w3.org/WAI/WCAG22/Understanding/target-size-minimum.html */
    +  min-inline-size: 24px;
    +  min-block-size: max(24px, 1.2em);
    +  align-content: center;
    +}
    +
    +select option::before {
    +  content: '\2713' / '';
    +}
    +select option:not(:checked)::before {
    +  visibility: hidden;
    +}
    + +
    @@ -143126,6 +143599,9 @@ INSERT INTERFACES HERE
    [CSSALIGN]
    CSS Box Alignment, E. Etemad, T. Atkins. W3C.
    +
    [CSSANCHOR]
    +
    CSS Anchor Positioning, T. Atkins, E. Etemad, I. Kilpatrick. W3C.
    +
    [CSSANIMATIONS]
    CSS Animations, D. Jackson, D. Hyatt, C. Marrin, S. Galineau, L. Baron. W3C.