@@ -53340,6 +53340,8 @@ interface <dfn interface>HTMLSelectElement</dfn> : <span>HTMLElement</span> {
53340
53340
undefined <span data-x="dom-select-showPicker">showPicker</span>();
53341
53341
53342
53342
readonly attribute <span>NodeList</span> <span data-x="dom-lfe-labels">labels</span>;
53343
+
53344
+ attribute <code data-x="selectedoption">HTMLSelectedOptionElement</code>? <span data-x="dom-selectedoptionelement">selectedOptionElement</span>;
53343
53345
};</code></pre>
53344
53346
</dd>
53345
53347
<dd w-dev>Uses <code>HTMLSelectElement</code>.</dd>
@@ -53401,6 +53403,21 @@ interface <dfn interface>HTMLSelectElement</dfn> : <span>HTMLElement</span> {
53401
53403
<p>Every <code>select</code> element has <dfn>select descendant selectedoption elements</dfn>,
53402
53404
which is a <span>list</span> of <code>selectedoption</code> elements, initially « ».</p>
53403
53405
53406
+ <p>To get the <dfn>select target selectedoption elements</dfn>, given a <code>select</code>
53407
+ <var>select</var>:</p>
53408
+
53409
+ <ol>
53410
+ <li><p>Let <var>selectedoptions</var> be <var>select</var>'s <span>select descendant
53411
+ selectedoption elements</span>.</p></li>
53412
+
53413
+ <!-- TODO dom-selectedoptionelement can likely be overriden by script, but the "limited to only
53414
+ known values" getter steps don't seem callable either. -->
53415
+ <li><p><span data-x="list append">Append</span> the value of <var>select</var>'s <code
53416
+ data-x="dom-selectedoptionelement">selectedOptionElement</code>, if it is non-null.</p></li>
53417
+
53418
+ <li><p>Return <var>selectedoptions</var>.</p></li>
53419
+ </ol>
53420
+
53404
53421
<p>The <dfn element-attr for="select"><code data-x="attr-select-required">required</code></dfn>
53405
53422
attribute is a <span>boolean attribute</span>. When specified, the user will be required to select
53406
53423
a value before submitting the form.</p>
@@ -53460,7 +53477,7 @@ interface <dfn interface>HTMLSelectElement</dfn> : <span>HTMLElement</span> {
53460
53477
53461
53478
<li><p><span>Send <code>select</code> update notifications</span>.</p></li>
53462
53479
53463
- <li><p>For each <var>selectedoption</var> in <var>select</var>'s <span>select descendant
53480
+ <li><p>For each <var>selectedoption</var> in <var>select</var>'s <span>select target
53464
53481
selectedoption elements</span>, run <span>clone an option into a selectedoption</span> given
53465
53482
<var>option</var> and <var>selectedoption</var>.</p></li>
53466
53483
</ol>
@@ -53516,7 +53533,7 @@ interface <dfn interface>HTMLSelectElement</dfn> : <span>HTMLElement</span> {
53516
53533
data-x="concept-option-selectedness">selectedness</span> set to true, or null if there is no such
53517
53534
<code>option</code>.</p></li>
53518
53535
53519
- <li><p>For each <var>selectedoption</var> in <var>element</var>'s <span>select descendant
53536
+ <li><p>For each <var>selectedoption</var> in <var>element</var>'s <span>select target
53520
53537
selectedoption elements</span>, run <span>clone an option into a selectedoption</span> given
53521
53538
<var>option</var> and <var>selectedoption</var>.</p></li>
53522
53539
</ol>
@@ -53801,7 +53818,7 @@ interface <dfn interface>HTMLSelectElement</dfn> : <span>HTMLElement</span> {
53801
53818
data-x="concept-option-selectedness">selectedness</span> to true and its <span
53802
53819
data-x="concept-option-dirtiness">dirtiness</span> to true.
53803
53820
53804
- <li><p>For each <var>selectedoption</var> in <var>select</var>'s <span>select descendant
53821
+ <li><p>For each <var>selectedoption</var> in <var>select</var>'s <span>select target
53805
53822
selectedoption elements</span>, run <span>clone an option into a selectedoption</span> given
53806
53823
<var>option</var> and <var>selectedoption</var>.</p></li>
53807
53824
</ol>
@@ -53924,6 +53941,64 @@ interface <dfn interface>HTMLSelectElement</dfn> : <span>HTMLElement</span> {
53924
53941
…</code></pre>
53925
53942
</div>
53926
53943
53944
+ <h4>The <code data-x="attr-selectedoptionelement">selectedoptionelement</code> attribute</h4>
53945
+
53946
+ <p><code>select</code> elements may have the <dfn element-attr
53947
+ for="select"><code data-x="attr-selectedoptionelement">selectedoptionelement</code></dfn>
53948
+ attribute. When specified its value must be the <span data-x="concept-ID">ID</span> of a
53949
+ <code>selectedoption</code> element in the same <span>tree</span> as the <code>select</code> with
53950
+ the <code data-x="attr-selectedoptionelement">selectedoptionelement</code> attribute. The target
53951
+ <code>selectedoption</code> will update its contents to match the currently selected
53952
+ <code>option</code> of the <code>select</code>.</p>
53953
+
53954
+ <div class="example">
53955
+ <p>The following code shows how the <code
53956
+ data-x="attr-selectedoptionelement">selectedoptionelement</code> attribute can be used to render
53957
+ a <code>select</code> element's value outside of the <code>select</code>:</p>
53958
+
53959
+ <pre><code class="html"><label for="pet-select">Choose a pet:</label>
53960
+ <select id="pet-select" selectedoptionelement="summary-value">
53961
+ <option>dog</option>
53962
+ <option>cat</option>
53963
+ </select>
53964
+ <p>Summary: you chose the <selectedoption id="summary-value"></selectedoption>.<p></code></pre>
53965
+ </div>
53966
+
53967
+ <p>The <dfn attribute for="select"><code
53968
+ data-x="dom-selectedoptionelement">selectedOptionElement</code></dfn> IDL attribute must
53969
+ <span>reflect</span> the <code data-x="attr-selectedoptionelement">selectedoptionelement</code>
53970
+ attribute, <span>limited to only known values</span>.</p>
53971
+
53972
+ <p>The following <span data-x="concept-element-attributes-change-ext">attribute change
53973
+ steps</span> given <var>element</var>, <var>localName</var>, <var>oldValue</var>,
53974
+ <var>value</var>, and <var>namespace</var>, are used for <code>select</code> elements:</p>
53975
+
53976
+ <ol>
53977
+ <li><p>If <var>namespace</var> is not null, then return.</p></li>
53978
+
53979
+ <li><p>If <var>localName</var> is not <code
53980
+ data-x="attr-selectedoptionelement">selectedoptionelement</code>, then return.</p></li>
53981
+
53982
+ <li><p>Let <var>oldSelectedoption</var> be the first <code>selectedoption</code> element in
53983
+ <span>tree order</span> in <var>element</var>'s <span>root</span> whose <span
53984
+ data-x="concept-ID">ID</span> is <var>oldValue</var> if one exists, otherwise null.</p></li>
53985
+
53986
+ <li><p>Let <var>newSelectedoption</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>value</var> if one exists, otherwise null.</p></li>
53989
+
53990
+ <li><p>If <var>oldSelectedoption</var> is eequal to <var>newSelectedoption</var>, then
53991
+ return.</p></li>
53992
+
53993
+ <li><p>If <var>oldSelectedoption</var> is not null, then run <span>clone an option into a
53994
+ selectedoption</span> given null and <var>oldSelectedOption</var>.</p></li>
53995
+
53996
+ <li><p>If <var>newSelectedoption</var> is not null, then run <span>clone an option into a
53997
+ selectedoption</span> given the value of <var>element</var>'s <code
53998
+ data-x="dom-selectedoptionelement">selectedOptionElement</code> and
53999
+ <var>newSelectedOption</var>.</p></li>
54000
+ </ol>
54001
+
53927
54002
53928
54003
53929
54004
<h4>The <dfn element><code>datalist</code></dfn> element</h4>
@@ -54295,7 +54370,7 @@ interface <dfn interface>HTMLOptionElement</dfn> : <span>HTMLElement</span> {
54295
54370
data-x="dom-option-label">label</span>.</p></li>
54296
54371
54297
54372
<li>
54298
- <p>For each <var>selectedoption</var> of <var>select</var>'s <span>select descendant
54373
+ <p>For each <var>selectedoption</var> of <var>select</var>'s <span>select target
54299
54374
selectedoption elements</span>:</p>
54300
54375
54301
54376
<ol>
0 commit comments