Skip to content

Commit

Permalink
Spec :user-invalid & :user-valid
Browse files Browse the repository at this point in the history
  • Loading branch information
nt1m committed Mar 30, 2023
1 parent 16c7464 commit c82ba6f
Showing 1 changed file with 57 additions and 17 deletions.
74 changes: 57 additions & 17 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -51780,17 +51780,18 @@ You cannot submit this form when the field is incorrect.</samp></pre>

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

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

<p><code>input</code> and <code>textarea</code> elements have a <dfn>user interacted</dfn> (a boolean).
It is initially set to false.</p>

<p>To define the behavior of constraint validation in the face of the <code>input</code>
element's <code data-x="attr-input-multiple">multiple</code> attribute, <code>input</code> elements
can also have separately defined <dfn data-x="concept-fe-values">value<em>s</em></dfn>.</p>
Expand Down Expand Up @@ -58731,8 +58735,8 @@ fur

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

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

<ol>
<li>If <var>resetUserInteracted</var> is true, set <var>field</var>'s <span>user interacted</span> to false.</li>

<li>
<p>If any of the following is true:</p>

Expand Down Expand Up @@ -72549,6 +72555,32 @@ Demos:
</ul>
</dd>

<dt><dfn selector noexport><code data-x="selector-user-valid">:user-valid</code></dfn></dt>
<dd>
<p>The <code data-x="selector-user-valid">:user-valid</code> <span>pseudo-class</span> must match
any element falling into one of the following categories:</p>
<ul>
<li><code>input</code> and <code>textarea</code> elements that have their <span>user interacted</span>
set to true, are <span data-x="candidate for constraint validation">candidates for constraint validation</span>
and that <span data-x="concept-fv-valid">satisfy their constraints</span>.</li>
<li><span>Buttons and other built-in elements that are <span data-x="candidate for constraint validation">candidates
for constraint validation</span> and that <span data-x="concept-fv-valid">satisfy their constraints</span>.</li>
</ul>
</dd>

<dt><dfn selector noexport><code data-x="selector-user-invalid">:user-invalid</code></dfn></dt>
<dd>
<p>The <code data-x="selector-user-valid">:user-valid</code> <span>pseudo-class</span> must match
any element falling into one of the following categories:</p>
<ul>
<li><code>input</code> and <code>textarea</code> elements that have their <span>user interacted</span>
set to true, are <span data-x="candidate for constraint validation">candidates for constraint validation</span>
but do not <span data-x="concept-fv-valid">satisfy their constraints</span>.</li>
<li><span>Buttons and other built-in elements that are <span data-x="candidate for constraint validation">candidates
for constraint validation</span> but do not <span data-x="concept-fv-valid">satisfy their constraints</span>.</li>
</ul>
</dd>

<dt><dfn selector noexport><code data-x="selector-in-range">:in-range</code></dfn></dt>
<dd>
<p>The <code data-x="selector-in-range">:in-range</code> <span>pseudo-class</span> must match
Expand Down Expand Up @@ -77870,16 +77902,24 @@ partial interface <span id="NavigatorUserActivation-partial">Navigator</span> {
these substeps:</p>

<ol>
<li id="unfocus-causes-change-event"><p>If <var>entry</var> is an <code>input</code>
element, and the <code data-x="event-change">change</code> event <span
data-x="concept-input-apply">applies</span> to the element, and the element does not have a
defined <span>activation behavior</span>, and the user has changed the element's <span
data-x="concept-fe-value">value</span> or its list of <span
data-x="concept-input-type-file-selected">selected files</span> while the control was focused
without committing that change (such that it is different to what it was when the control was
first focused), then <span data-x="concept-event-fire">fire an event</span> named <code
data-x="event-change">change</code> at the element, with the <code
data-x="dom-Event-bubbles">bubbles</code> attribute initialized to true.</p>
<li>
<p>If <var>entry</var> is an <code>input</code>
element, and the <code data-x="event-change">change</code> event <span
data-x="concept-input-apply">applies</span> to the element, and the element does not have a
defined <span>activation behavior</span>, and the user has changed the element's <span
data-x="concept-fe-value">value</span> or its list of <span
data-x="concept-input-type-file-selected">selected files</span> while the control was focused
without committing that change (such that it is different to what it was when the control was
first focused), then:

<ol>
<li>Set <var>entry</var>'s <span>user interacted</span> to true.</li>

<li id="unfocus-causes-change-event"><span data-x="concept-event-fire">Fire an event</span> named <code
data-x="event-change">change</code> at the element, with the <code
data-x="dom-Event-bubbles">bubbles</code> attribute initialized to true.</li>
</ol>
</li>

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

0 comments on commit c82ba6f

Please sign in to comment.