@@ -53344,6 +53344,8 @@ interface <dfn interface>HTMLSelectElement</dfn> : <span>HTMLElement</span> {
53344
53344
undefined <span data-x="dom-select-showPicker">showPicker</span>();
53345
53345
53346
53346
readonly attribute <span>NodeList</span> <span data-x="dom-lfe-labels">labels</span>;
53347
+
53348
+ attribute <code data-x="selectedoption">HTMLSelectedOptionElement</code>? <span data-x="dom-selectedoptionelement">selectedOptionElement</span>;
53347
53349
};</code></pre>
53348
53350
</dd>
53349
53351
<dd w-dev>Uses <code>HTMLSelectElement</code>.</dd>
@@ -53405,6 +53407,21 @@ interface <dfn interface>HTMLSelectElement</dfn> : <span>HTMLElement</span> {
53405
53407
<p>Every <code>select</code> element has <dfn>select descendant selectedoption elements</dfn>,
53406
53408
which is a <span>list</span> of <code>selectedoption</code> elements, initially « ».</p>
53407
53409
53410
+ <p>To get the <dfn>select target selectedoption elements</dfn>, given a <code>select</code>
53411
+ <var>select</var>:</p>
53412
+
53413
+ <ol>
53414
+ <li><p>Let <var>selectedoptions</var> be <var>select</var>'s <span>select descendant
53415
+ selectedoption elements</span>.</p></li>
53416
+
53417
+ <!-- TODO dom-selectedoptionelement can likely be overriden by script, but the "limited to only
53418
+ known values" getter steps don't seem callable either. -->
53419
+ <li><p><span data-x="list append">Append</span> the value of <var>select</var>'s <code
53420
+ data-x="dom-selectedoptionelement">selectedOptionElement</code>, if it is non-null.</p></li>
53421
+
53422
+ <li><p>Return <var>selectedoptions</var>.</p></li>
53423
+ </ol>
53424
+
53408
53425
<p>The <dfn element-attr for="select"><code data-x="attr-select-required">required</code></dfn>
53409
53426
attribute is a <span>boolean attribute</span>. When specified, the user will be required to select
53410
53427
a value before submitting the form.</p>
@@ -53464,7 +53481,7 @@ interface <dfn interface>HTMLSelectElement</dfn> : <span>HTMLElement</span> {
53464
53481
53465
53482
<li><p><span>Send <code>select</code> update notifications</span>.</p></li>
53466
53483
53467
- <li><p>For each <var>selectedoption</var> in <var>select</var>'s <span>select descendant
53484
+ <li><p>For each <var>selectedoption</var> in <var>select</var>'s <span>select target
53468
53485
selectedoption elements</span>, run <span>clone an option into a selectedoption</span> given
53469
53486
<var>option</var> and <var>selectedoption</var>.</p></li>
53470
53487
</ol>
@@ -53520,7 +53537,7 @@ interface <dfn interface>HTMLSelectElement</dfn> : <span>HTMLElement</span> {
53520
53537
data-x="concept-option-selectedness">selectedness</span> set to true, or null if there is no such
53521
53538
<code>option</code>.</p></li>
53522
53539
53523
- <li><p>For each <var>selectedoption</var> in <var>element</var>'s <span>select descendant
53540
+ <li><p>For each <var>selectedoption</var> in <var>element</var>'s <span>select target
53524
53541
selectedoption elements</span>, run <span>clone an option into a selectedoption</span> given
53525
53542
<var>option</var> and <var>selectedoption</var>.</p></li>
53526
53543
</ol>
@@ -53805,7 +53822,7 @@ interface <dfn interface>HTMLSelectElement</dfn> : <span>HTMLElement</span> {
53805
53822
data-x="concept-option-selectedness">selectedness</span> to true and its <span
53806
53823
data-x="concept-option-dirtiness">dirtiness</span> to true.
53807
53824
53808
- <li><p>For each <var>selectedoption</var> in <var>select</var>'s <span>select descendant
53825
+ <li><p>For each <var>selectedoption</var> in <var>select</var>'s <span>select target
53809
53826
selectedoption elements</span>, run <span>clone an option into a selectedoption</span> given
53810
53827
<var>option</var> and <var>selectedoption</var>.</p></li>
53811
53828
</ol>
@@ -53928,6 +53945,64 @@ interface <dfn interface>HTMLSelectElement</dfn> : <span>HTMLElement</span> {
53928
53945
…</code></pre>
53929
53946
</div>
53930
53947
53948
+ <h4>The <code data-x="attr-selectedoptionelement">selectedoptionelement</code> attribute</h4>
53949
+
53950
+ <p><code>select</code> elements may have the <dfn element-attr
53951
+ for="select"><code data-x="attr-selectedoptionelement">selectedoptionelement</code></dfn>
53952
+ attribute. When specified its value must be the <span data-x="concept-ID">ID</span> of a
53953
+ <code>selectedoption</code> element in the same <span>tree</span> as the <code>select</code> with
53954
+ the <code data-x="attr-selectedoptionelement">selectedoptionelement</code> attribute. The target
53955
+ <code>selectedoption</code> will update its contents to match the currently selected
53956
+ <code>option</code> of the <code>select</code>.</p>
53957
+
53958
+ <div class="example">
53959
+ <p>The following code shows how the <code
53960
+ data-x="attr-selectedoptionelement">selectedoptionelement</code> attribute can be used to render
53961
+ a <code>select</code> element's value outside of the <code>select</code>:</p>
53962
+
53963
+ <pre><code class="html"><label for="pet-select">Choose a pet:</label>
53964
+ <select id="pet-select" selectedoptionelement="summary-value">
53965
+ <option>dog</option>
53966
+ <option>cat</option>
53967
+ </select>
53968
+ <p>Summary: you chose the <selectedoption id="summary-value"></selectedoption>.<p></code></pre>
53969
+ </div>
53970
+
53971
+ <p>The <dfn attribute for="select"><code
53972
+ data-x="dom-selectedoptionelement">selectedOptionElement</code></dfn> IDL attribute must
53973
+ <span>reflect</span> the <code data-x="attr-selectedoptionelement">selectedoptionelement</code>
53974
+ attribute, <span>limited to only known values</span>.</p>
53975
+
53976
+ <p>The following <span data-x="concept-element-attributes-change-ext">attribute change
53977
+ steps</span> given <var>element</var>, <var>localName</var>, <var>oldValue</var>,
53978
+ <var>value</var>, and <var>namespace</var>, are used for <code>select</code> elements:</p>
53979
+
53980
+ <ol>
53981
+ <li><p>If <var>namespace</var> is not null, then return.</p></li>
53982
+
53983
+ <li><p>If <var>localName</var> is not <code
53984
+ data-x="attr-selectedoptionelement">selectedoptionelement</code>, then return.</p></li>
53985
+
53986
+ <li><p>Let <var>oldSelectedoption</var> be the first <code>selectedoption</code> element in
53987
+ <span>tree order</span> in <var>element</var>'s <span>root</span> whose <span
53988
+ data-x="concept-ID">ID</span> is <var>oldValue</var> if one exists, otherwise null.</p></li>
53989
+
53990
+ <li><p>Let <var>newSelectedoption</var> be the first <code>selectedoption</code> element in
53991
+ <span>tree order</span> in <var>element</var>'s <span>root</span> whose <span
53992
+ data-x="concept-ID">ID</span> is <var>value</var> if one exists, otherwise null.</p></li>
53993
+
53994
+ <li><p>If <var>oldSelectedoption</var> is eequal to <var>newSelectedoption</var>, then
53995
+ return.</p></li>
53996
+
53997
+ <li><p>If <var>oldSelectedoption</var> is not null, then run <span>clone an option into a
53998
+ selectedoption</span> given null and <var>oldSelectedOption</var>.</p></li>
53999
+
54000
+ <li><p>If <var>newSelectedoption</var> is not null, then run <span>clone an option into a
54001
+ selectedoption</span> given the value of <var>element</var>'s <code
54002
+ data-x="dom-selectedoptionelement">selectedOptionElement</code> and
54003
+ <var>newSelectedOption</var>.</p></li>
54004
+ </ol>
54005
+
53931
54006
53932
54007
53933
54008
<h4>The <dfn element><code>datalist</code></dfn> element</h4>
@@ -54299,7 +54374,7 @@ interface <dfn interface>HTMLOptionElement</dfn> : <span>HTMLElement</span> {
54299
54374
data-x="dom-option-label">label</span>.</p></li>
54300
54375
54301
54376
<li>
54302
- <p>For each <var>selectedoption</var> of <var>select</var>'s <span>select descendant
54377
+ <p>For each <var>selectedoption</var> of <var>select</var>'s <span>select target
54303
54378
selectedoption elements</span>:</p>
54304
54379
54305
54380
<ol>
0 commit comments