Skip to content

Commit f873032

Browse files
lukewarlowlozy219
authored andcommitted
Add showPicker() to <select> elements
Closes whatwg#7957.
1 parent 4b945e6 commit f873032

File tree

1 file changed

+38
-7
lines changed

1 file changed

+38
-7
lines changed

Diff for: source

+38-7
Original file line numberDiff line numberDiff line change
@@ -52397,8 +52397,10 @@ You cannot submit this form when the field is incorrect.</samp></pre>
5239752397

5239852398
<hr>
5239952399

52400-
<p>The <dfn method for="HTMLInputElement"><code
52401-
data-x="dom-input-showPicker">showPicker()</code></dfn> method steps are:</p>
52400+
<p>The <code>HTMLInputElement</code> <dfn method for="HTMLInputElement"><code
52401+
data-x="dom-input-showPicker">showPicker()</code></dfn> and <code>HTMLSelectElement</code> <dfn
52402+
method for="HTMLSelectElement"><code data-x="dom-select-showPicker">showPicker()</code></dfn>
52403+
method steps are:</p>
5240252404

5240352405
<ol>
5240452406
<li><p>If <span>this</span> is not <span data-x="concept-fe-mutable">mutable</span>, then throw
@@ -52408,6 +52410,7 @@ You cannot submit this form when the field is incorrect.</samp></pre>
5240852410
<p>If <span>this</span>'s <span>relevant settings object</span>'s <span
5240952411
data-x="concept-settings-object-origin">origin</span> is not <span>same origin</span> with
5241052412
<span>this</span>'s <span>relevant settings object</span>'s <span>top-level origin</span>, and
52413+
<span>this</span> is a <code>select</code> element, or
5241152414
<span>this</span>'s <code data-x="attr-input-type">type</code> attribute is not in the <span
5241252415
data-x="attr-input-type-file">File Upload</span> state or <span
5241352416
data-x="attr-input-type-color">Color</span> state, then throw a
@@ -52423,11 +52426,15 @@ You cannot submit this form when the field is incorrect.</samp></pre>
5242352426
activation</span>, then throw a <span>"<code>NotAllowedError</code>"</span>
5242452427
<code>DOMException</code>.</p></li>
5242552428

52429+
<li><p>If <span>this</span> is a <code>select</code> element, and <span>this</span> is not
52430+
<span>being rendered</span>, then throw a <span>"<code>NotSupportedError</code>"</span>
52431+
<code>DOMException</code>.<p></li>
52432+
5242652433
<li><p><span>Show the picker, if applicable</span>, for <span>this</span>.</p></li>
5242752434
</ol>
5242852435

52429-
<p>To <dfn>show the picker, if applicable</dfn> for an <code>input</code> element
52430-
<var>element</var>:</p>
52436+
<p>To <dfn>show the picker, if applicable</dfn> for an <code>input</code> or <code>select</code>
52437+
element <var>element</var>:</p>
5243152438

5243252439
<ol>
5243352440
<li><p>If <var>element</var>'s <span>relevant global object</span> does not have <span>transient
@@ -52437,7 +52444,8 @@ You cannot submit this form when the field is incorrect.</samp></pre>
5243752444
return.</p></li>
5243852445

5243952446
<li>
52440-
<p>If <var>element</var>'s <code data-x="attr-input-type">type</code> attribute is in the <span
52447+
<p>If <var>element</var> is an <code>input</code> element and <var>element</var>'s <code
52448+
data-x="attr-input-type">type</code> attribute is in the <span
5244152449
data-x="attr-input-type-file">File Upload</span> state, then run these steps <span>in
5244252450
parallel</span>:</p>
5244352451

@@ -52502,11 +52510,13 @@ You cannot submit this form when the field is incorrect.</samp></pre>
5250252510
data-x="attr-input-type-color">Color</span> states;</p></li>
5250352511

5250452512
<li><p><code>input</code> elements in various states that have a <span
52505-
data-x="concept-input-list">suggestions source element</span>; and</p></li>
52513+
data-x="concept-input-list">suggestions source element</span>;</p></li>
5250652514

5250752515
<li><p><code>input</code> elements whose <code data-x="attr-input-type">type</code> attribute
5250852516
is in the <span data-x="attr-input-type-file">File Upload</span> state (although those are
52509-
handled via the special case above, instead of by this step).</p></li>
52517+
handled via the special case above, instead of by this step); and</p></li>
52518+
52519+
<li><p><code>select</code> elements.</p></li>
5251052520
</ul>
5251152521

5251252522
<p>However, the intent of this step is to trigger <em>any</em> picker UI implementation. So
@@ -52932,6 +52942,8 @@ interface <dfn interface>HTMLSelectElement</dfn> : <span>HTMLElement</span> {
5293252942
boolean <span data-x="dom-cva-reportValidity">reportValidity</span>();
5293352943
undefined <span data-x="dom-cva-setCustomValidity">setCustomValidity</span>(DOMString error);
5293452944

52945+
undefined <span data-x="dom-select-showPicker">showPicker</span>();
52946+
5293552947
readonly attribute <span>NodeList</span> <span data-x="dom-lfe-labels">labels</span>;
5293652948
};</code></pre>
5293752949
</dd>
@@ -53259,6 +53271,24 @@ interface <dfn interface>HTMLSelectElement</dfn> : <span>HTMLElement</span> {
5325953271

5326053272
<p>Can be set, to change the selection.</p>
5326153273
</dd>
53274+
53275+
<dt><code data-x=""><var>select</var>.<span subdfn data-x="dom-select-showPicker">showPicker</span>()</code></dt>
53276+
53277+
<dd>
53278+
<p>Shows any applicable picker UI for <var>select</var>, so that the user can select a value.
53279+
53280+
<p>Throws an <span>"<code>InvalidStateError</code>"</span> <code>DOMException</code> if
53281+
<var>select</var> is not <span data-x="concept-fe-mutable">mutable</span>.</p>
53282+
53283+
<p>Throws a <span>"<code>NotAllowedError</code>"</span> <code>DOMException</code> if called
53284+
without <span data-x="transient activation">transient user activation</span>.</p>
53285+
53286+
<p>Throws a <span>"<code>SecurityError</code>"</span> <code>DOMException</code> if
53287+
<var>select</var> is inside a cross-origin <code>iframe</code>.</p>
53288+
53289+
<p>Throws a <span>"<code>NotSupportedError</code>"</span> <code>DOMException</code> if
53290+
<var>select</var> is not <span>being rendered</span>.</p>
53291+
</dd>
5326253292
</dl>
5326353293

5326453294
<div w-nodev>
@@ -141068,6 +141098,7 @@ INSERT INTERFACES HERE
141068141098
Lucas Gadani,
141069141099
&#x0141;ukasz Pilorz,
141070141100
Luke Kenneth Casson Leighton,
141101+
Luke Warlow,
141071141102
Luke Wilde,
141072141103
Maciej Stachowiak,
141073141104
Magne Andersson,

0 commit comments

Comments
 (0)