diff --git a/source b/source index 863ca772e0c..a41cb974427 100644 --- a/source +++ b/source @@ -53365,6 +53365,8 @@ interface HTMLSelectElement : HTMLElement { undefined showPicker(); readonly attribute NodeList labels; + + attribute HTMLSelectedOptionElement? selectedOptionElement; };
Uses HTMLSelectElement.
@@ -53426,6 +53428,21 @@ interface HTMLSelectElement : HTMLElement {

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 a value before submitting the form.

@@ -53485,7 +53502,7 @@ interface HTMLSelectElement : HTMLElement {
  • Send select update notifications.

  • -
  • For each selectedoption in select's select descendant +

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

  • @@ -53541,7 +53558,7 @@ interface HTMLSelectElement : HTMLElement { data-x="concept-option-selectedness">selectedness set to true, or null if there is no such option.

    -
  • For each selectedoption in element's select descendant +

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

  • @@ -53876,7 +53893,7 @@ interface HTMLSelectElement : HTMLElement { data-x="concept-option-selectedness">selectedness to true and its dirtiness to true. -
  • For each selectedoption in select's select descendant +

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

  • @@ -53999,6 +54016,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

    @@ -54403,7 +54478,7 @@ interface HTMLOptionElement : HTMLElement { data-x="dom-option-label">label.

  • -

    For each selectedoption of select's select descendant +

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