Skip to content

Commit c82ba6f

Browse files
committed
Spec :user-invalid & :user-valid
Fixes whatwg#8452
1 parent 16c7464 commit c82ba6f

File tree

1 file changed

+57
-17
lines changed

1 file changed

+57
-17
lines changed

source

Lines changed: 57 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -51780,17 +51780,18 @@ You cannot submit this form when the field is incorrect.</samp></pre>
5178051780

5178151781
<p>For <code>input</code> elements without a defined <span>input activation behavior</span>, but
5178251782
to which these events <span data-x="concept-input-apply">apply</span>, and for which the user
51783-
interface involves both interactive manipulation and an explicit commit action, then when the user
51784-
changes the element's <span data-x="concept-fe-value">value</span>, the user agent must
51783+
interface involves both interactive manipulation and an explicit commit action, then when the
51784+
user changes the element's <span data-x="concept-fe-value">value</span>, the user agent must
5178551785
<span>queue an element task</span> on the <span>user interaction task source</span> given the
5178651786
<code>input</code> element to <span data-x="concept-event-fire">fire an event</span> named <code
5178751787
data-x="event-input">input</code> at the <code>input</code> element, with the <code
5178851788
data-x="dom-Event-bubbles">bubbles</code> and <code data-x="dom-Event-composed">composed</code>
5178951789
attributes initialized to true, and any time the user commits the change, the user agent must
5179051790
<span>queue an element task</span> on the <span>user interaction task source</span> given the
51791-
<code>input</code> element to <span data-x="concept-event-fire">fire an event</span> named <code
51792-
data-x="event-change">change</code> at the <code>input</code> element, with the <code
51793-
data-x="dom-Event-bubbles">bubbles</code> attribute initialized to true.</p>
51791+
<code>input</code> element to set its <span>user interacted</span> to true and <span
51792+
data-x="concept-event-fire">fire an event</span> named <code data-x="event-change">change</code>
51793+
at the <code>input</code> element, with the <code data-x="dom-Event-bubbles">bubbles</code>
51794+
attribute initialized to true.</p>
5179451795

5179551796
<p class="example">An example of a user interface involving both interactive manipulation and a
5179651797
commit action would be a <span data-x="attr-input-type-range">Range</span> controls that use a
@@ -54673,6 +54674,9 @@ interface <dfn interface>HTMLLegendElement</dfn> : <span>HTMLElement</span> {
5467354674
default value. If it is false, <span data-x="concept-fe-value">value</span> mirrors the default
5467454675
value. If it is true, the default value is ignored.</p>
5467554676

54677+
<p><code>input</code> and <code>textarea</code> elements have a <dfn>user interacted</dfn> (a boolean).
54678+
It is initially set to false.</p>
54679+
5467654680
<p>To define the behavior of constraint validation in the face of the <code>input</code>
5467754681
element's <code data-x="attr-input-multiple">multiple</code> attribute, <code>input</code> elements
5467854682
can also have separately defined <dfn data-x="concept-fe-values">value<em>s</em></dfn>.</p>
@@ -58731,8 +58735,8 @@ fur
5873158735

5873258736
<p>The algorithm to <dfn id="constructing-the-form-data-set" export data-lt="constructing the
5873358737
entry list" data-x="constructing the entry list">construct the entry list</dfn> given a
58734-
<var>form</var>, an optional <var>submitter</var>, and an optional <var>encoding</var>, is as
58735-
follows. If not specified otherwise, <var>submitter</var> is null.</p>
58738+
<var>form</var>, an optional <var>submitter</var>, an optional <var>resetUserInteracted</var>
58739+
and an optional <var>encoding</var>, is as follows. If not specified otherwise, <var>submitter</var> is null.</p>
5873658740

5873758741
<ol>
5873858742
<li><p>If <var>form</var>'s <span>constructing entry list</span> is true, then return
@@ -58749,6 +58753,8 @@ fur
5874958753
<p>For each element <var>field</var> in <var>controls</var>, in <span>tree order</span>:</p>
5875058754

5875158755
<ol>
58756+
<li>If <var>resetUserInteracted</var> is true, set <var>field</var>'s <span>user interacted</span> to false.</li>
58757+
5875258758
<li>
5875358759
<p>If any of the following is true:</p>
5875458760

@@ -72549,6 +72555,32 @@ Demos:
7254972555
</ul>
7255072556
</dd>
7255172557

72558+
<dt><dfn selector noexport><code data-x="selector-user-valid">:user-valid</code></dfn></dt>
72559+
<dd>
72560+
<p>The <code data-x="selector-user-valid">:user-valid</code> <span>pseudo-class</span> must match
72561+
any element falling into one of the following categories:</p>
72562+
<ul>
72563+
<li><code>input</code> and <code>textarea</code> elements that have their <span>user interacted</span>
72564+
set to true, are <span data-x="candidate for constraint validation">candidates for constraint validation</span>
72565+
and that <span data-x="concept-fv-valid">satisfy their constraints</span>.</li>
72566+
<li><span>Buttons and other built-in elements that are <span data-x="candidate for constraint validation">candidates
72567+
for constraint validation</span> and that <span data-x="concept-fv-valid">satisfy their constraints</span>.</li>
72568+
</ul>
72569+
</dd>
72570+
72571+
<dt><dfn selector noexport><code data-x="selector-user-invalid">:user-invalid</code></dfn></dt>
72572+
<dd>
72573+
<p>The <code data-x="selector-user-valid">:user-valid</code> <span>pseudo-class</span> must match
72574+
any element falling into one of the following categories:</p>
72575+
<ul>
72576+
<li><code>input</code> and <code>textarea</code> elements that have their <span>user interacted</span>
72577+
set to true, are <span data-x="candidate for constraint validation">candidates for constraint validation</span>
72578+
but do not <span data-x="concept-fv-valid">satisfy their constraints</span>.</li>
72579+
<li><span>Buttons and other built-in elements that are <span data-x="candidate for constraint validation">candidates
72580+
for constraint validation</span> but do not <span data-x="concept-fv-valid">satisfy their constraints</span>.</li>
72581+
</ul>
72582+
</dd>
72583+
7255272584
<dt><dfn selector noexport><code data-x="selector-in-range">:in-range</code></dfn></dt>
7255372585
<dd>
7255472586
<p>The <code data-x="selector-in-range">:in-range</code> <span>pseudo-class</span> must match
@@ -77870,16 +77902,24 @@ partial interface <span id="NavigatorUserActivation-partial">Navigator</span> {
7787077902
these substeps:</p>
7787177903

7787277904
<ol>
77873-
<li id="unfocus-causes-change-event"><p>If <var>entry</var> is an <code>input</code>
77874-
element, and the <code data-x="event-change">change</code> event <span
77875-
data-x="concept-input-apply">applies</span> to the element, and the element does not have a
77876-
defined <span>activation behavior</span>, and the user has changed the element's <span
77877-
data-x="concept-fe-value">value</span> or its list of <span
77878-
data-x="concept-input-type-file-selected">selected files</span> while the control was focused
77879-
without committing that change (such that it is different to what it was when the control was
77880-
first focused), then <span data-x="concept-event-fire">fire an event</span> named <code
77881-
data-x="event-change">change</code> at the element, with the <code
77882-
data-x="dom-Event-bubbles">bubbles</code> attribute initialized to true.</p>
77905+
<li>
77906+
<p>If <var>entry</var> is an <code>input</code>
77907+
element, and the <code data-x="event-change">change</code> event <span
77908+
data-x="concept-input-apply">applies</span> to the element, and the element does not have a
77909+
defined <span>activation behavior</span>, and the user has changed the element's <span
77910+
data-x="concept-fe-value">value</span> or its list of <span
77911+
data-x="concept-input-type-file-selected">selected files</span> while the control was focused
77912+
without committing that change (such that it is different to what it was when the control was
77913+
first focused), then:
77914+
77915+
<ol>
77916+
<li>Set <var>entry</var>'s <span>user interacted</span> to true.</li>
77917+
77918+
<li id="unfocus-causes-change-event"><span data-x="concept-event-fire">Fire an event</span> named <code
77919+
data-x="event-change">change</code> at the element, with the <code
77920+
data-x="dom-Event-bubbles">bubbles</code> attribute initialized to true.</li>
77921+
</ol>
77922+
</li>
7788377923

7788477924
<li>
7788577925
<p>If <var>entry</var> is an element, let <var>blur event target</var> be

0 commit comments

Comments
 (0)