- From: Ian Hickson via cvs-syncmail <cvsmail@w3.org>
- Date: Fri, 10 Oct 2008 04:32:40 +0000
- To: public-html-commits@w3.org
Update of /sources/public/html5/spec In directory hutz:/tmp/cvs-serv3670 Modified Files: Overview.html Log Message: WF2: constraint validation API (whatwg r2321) Index: Overview.html =================================================================== RCS file: /sources/public/html5/spec/Overview.html,v retrieving revision 1.1493 retrieving revision 1.1494 diff -u -d -r1.1493 -r1.1494 --- Overview.html 10 Oct 2008 02:54:57 -0000 1.1493 +++ Overview.html 10 Oct 2008 04:32:37 -0000 1.1494 @@ -18480,7 +18480,7 @@ readonly attribute <a href=#htmlformcontrolscollection-0>HTMLFormControlsCollection</a> <a href=#dom-fieldset-elements title=dom-fieldset-elements>elements</a>; readonly attribute boolean <a href=#dom-cva-willvalidate title=dom-cva-willValidate>willValidate</a>; - readonly attribute <span>ValidityState</span> <a href=#dom-cva-validity title=dom-cva-validity>validity</a>; + readonly attribute <a href=#validitystate>ValidityState</a> <a href=#dom-cva-validity title=dom-cva-validity>validity</a>; readonly attribute DOMString <a href=#dom-cva-validationmessage title=dom-cva-validationMessage>validationMessage</a>; boolean <a href=#dom-cva-checkvalidatity title=dom-cva-checkValidatity>checkValidity</a>(); void <a href=#dom-cva-setcustomvalidity title=dom-cva-setCustomValidity>setCustomValidity</a>(in DOMString error); @@ -18642,7 +18642,7 @@ void <a href=#dom-input-stepdown title=dom-input-stepDown>stepDown</a>(in int n); readonly attribute boolean <a href=#dom-cva-willvalidate title=dom-cva-willValidate>willValidate</a>; - readonly attribute <span>ValidityState</span> <a href=#dom-cva-validity title=dom-cva-validity>validity</a>; + readonly attribute <a href=#validitystate>ValidityState</a> <a href=#dom-cva-validity title=dom-cva-validity>validity</a>; readonly attribute DOMString <a href=#dom-cva-validationmessage title=dom-cva-validationMessage>validationMessage</a>; boolean <a href=#dom-cva-checkvalidatity title=dom-cva-checkValidatity>checkValidity</a>(); void <a href=#dom-cva-setcustomvalidity title=dom-cva-setCustomValidity>setCustomValidity</a>(in DOMString error); @@ -21266,7 +21266,7 @@ attribute DOMString <a href=#dom-button-value title=dom-button-value>value</a>; readonly attribute boolean <a href=#dom-cva-willvalidate title=dom-cva-willValidate>willValidate</a>; - readonly attribute <span>ValidityState</span> <a href=#dom-cva-validity title=dom-cva-validity>validity</a>; + readonly attribute <a href=#validitystate>ValidityState</a> <a href=#dom-cva-validity title=dom-cva-validity>validity</a>; readonly attribute DOMString <a href=#dom-cva-validationmessage title=dom-cva-validationMessage>validationMessage</a>; boolean <a href=#dom-cva-checkvalidatity title=dom-cva-checkValidatity>checkValidity</a>(); void <a href=#dom-cva-setcustomvalidity title=dom-cva-setCustomValidity>setCustomValidity</a>(in DOMString error); @@ -21373,7 +21373,7 @@ attribute DOMString <a href=#dom-select-value title=dom-select-value>value</a>; readonly attribute boolean <a href=#dom-cva-willvalidate title=dom-cva-willValidate>willValidate</a>; - readonly attribute <span>ValidityState</span> <a href=#dom-cva-validity title=dom-cva-validity>validity</a>; + readonly attribute <a href=#validitystate>ValidityState</a> <a href=#dom-cva-validity title=dom-cva-validity>validity</a>; readonly attribute DOMString <a href=#dom-cva-validationmessage title=dom-cva-validationMessage>validationMessage</a>; boolean <a href=#dom-cva-checkvalidatity title=dom-cva-checkValidatity>checkValidity</a>(); void <a href=#dom-cva-setcustomvalidity title=dom-cva-setCustomValidity>setCustomValidity</a>(in DOMString error); @@ -21685,7 +21685,7 @@ attribute DOMString <a href=#dom-textarea-value title=dom-textarea-value>value</a>; readonly attribute boolean <a href=#dom-cva-willvalidate title=dom-cva-willValidate>willValidate</a>; - readonly attribute <span>ValidityState</span> <a href=#dom-cva-validity title=dom-cva-validity>validity</a>; + readonly attribute <a href=#validitystate>ValidityState</a> <a href=#dom-cva-validity title=dom-cva-validity>validity</a>; readonly attribute DOMString <a href=#dom-cva-validationmessage title=dom-cva-validationMessage>validationMessage</a>; boolean <a href=#dom-cva-checkvalidatity title=dom-cva-checkValidatity>checkValidity</a>(); void <a href=#dom-cva-setcustomvalidity title=dom-cva-setCustomValidity>setCustomValidity</a>(in DOMString error); @@ -21816,7 +21816,7 @@ attribute DOMString <a href=#dom-output-value title=dom-output-value>value</a>; readonly attribute boolean <a href=#dom-cva-willvalidate title=dom-cva-willValidate>willValidate</a>; - readonly attribute <span>ValidityState</span> <a href=#dom-cva-validity title=dom-cva-validity>validity</a>; + readonly attribute <a href=#validitystate>ValidityState</a> <a href=#dom-cva-validity title=dom-cva-validity>validity</a>; readonly attribute DOMString <a href=#dom-cva-validationmessage title=dom-cva-validationMessage>validationMessage</a>; boolean <a href=#dom-cva-checkvalidatity title=dom-cva-checkValidatity>checkValidity</a>(); void <a href=#dom-cva-setcustomvalidity title=dom-cva-setCustomValidity>setCustomValidity</a>(in DOMString error); @@ -22042,9 +22042,17 @@ validation">barred the element from constraint validation</dfn>. (For example, an element is <a href=#barred-from-constraint-validation>barred from constraint validation</a> if it is an <code><a href=#the-output-element>output</a></code> or - <code><a href=#the-fieldset-element>fieldset</a></code> element.)<p>An element can be constrained in various ways. The following is - the list of ailments that a form control can suffer from, making the - control invalid for the purposes of constraint valiation:<dl><dt> <dfn id=suffering-from-being-missing>Suffering from being missing</dfn> </dt> + <code><a href=#the-fieldset-element>fieldset</a></code> element.)<p>An element can have a <dfn id=custom-validity-error-message>custom validity error message</dfn> + defined. Initially, an element must have its <a href=#custom-validity-error-message>custom validity + error message</a> set to the empty string. When its value is not + the empty string, the element is <a href=#suffering-from-a-custom-error>suffering from a custom + error</a>. It can be set using the <code title=dom-cva-setCustomValidity><a href=#dom-cva-setcustomvalidity>setCustomValidity()</a></code> + method. The user agent should use the <a href=#custom-validity-error-message>custom validity error + message</a> when alerting the user to the problem with the + control.<p>An element can be constrained in various ways. The following is + the list of <dfn id=validity-states>validity states</dfn> that a form control can be + in, making the control invalid for the purposes of constraint + valiation:<dl><dt> <dfn id=suffering-from-being-missing>Suffering from being missing</dfn> </dt> <dd> <p>When a control has no <a href=#concept-fe-value title=concept-fe-value>value</a> but has a <code title="">required</code> attribute (<code><a href=#the-input-element>input</a></code> <code title=attr-input-required><a href=#attr-input-required>required</a></code>, <code><a href=#the-textarea-element>textarea</a></code> <code title=attr-textarea-required><a href=#attr-textarea-required>required</a></code>). </dd> @@ -22081,9 +22089,15 @@ given by the <code title=attr-input-step><a href=#attr-input-step>step</a></code> attribute.</dd> + <dt> <dfn id=suffering-from-a-custom-error>Suffering from a custom error</dfn> </dt> + + <dd> <p>When a control's <a href=#custom-validity-error-message>custom validity error message</a> + (as set by the element's <code title=dom-cva-setCustomValidity><a href=#dom-cva-setcustomvalidity>setCustomValidity()</a></code> + method) is not the empty string.</p> </dd> + </dl><p>An element <dfn id=concept-fv-valid title=concept-fv-valid>satisfies its constraints</dfn> if it is not suffering from any of the above - ailments.<h5 id=constraint-validation><span class=secno>4.10.14.2 </span>Constraint validation</h5><p>When the user agent is required to <dfn id=statically-validate-the-constraints>statically validate the + <a href=#validity-states>validity states</a>.<h5 id=constraint-validation><span class=secno>4.10.14.2 </span>Constraint validation</h5><p>When the user agent is required to <dfn id=statically-validate-the-constraints>statically validate the constraints</dfn> of <code><a href=#the-form-element>form</a></code> element <var title="">form</var>, it must run the following steps, which return either a <i>positive</i> result (all the controls in the form are valid) or a <i>negative</i> result (there are invalid controls) @@ -22161,9 +22175,67 @@ attribute must return true if an element is a <a href=#candidate-for-constraint-validation>candidate for constraint validation</a>, and false otherwise (i.e. false if any conditions are <a href=#barred-from-constraint-validation title="barred from constraint - validation">barring it from constraint validation</a>).<p class=XXX> <dfn id=dom-cva-validity title=dom-cva-validity><code>validity</code></dfn> <dfn id=dom-cva-validationmessage title=dom-cva-validationMessage><code>validationMessage</code></dfn> - <dfn id=dom-cva-checkvalidatity title=dom-cva-checkValidatity><code>checkValidity()</code></dfn> - <dfn id=dom-cva-setcustomvalidity title=dom-cva-setCustomValidity><code>setCustomValidity()</code></dfn><h4 id=form-submission-0><span class=secno>4.10.15 </span>Form submission</h4><!-- XXX http://lxr.mozilla.org/mozilla/source/content/html/content/src/nsHTMLFormElement.cpp --><p>When a form <var title="">form</var> is <dfn id=concept-form-submit title=concept-form-submit>submitted</dfn> from an element <var title="">submitter</var> (typically a button), the user agent must + validation">barring it from constraint validation</a>).<p>The <dfn id=dom-cva-setcustomvalidity title=dom-cva-setCustomValidity><code>setCustomValidity(<var title="">message</var>)</code></dfn>, when invoked, must set the + <a href=#custom-validity-error-message>custom validity error message</a> to the value of the given + <var title="">message</var> argument.<p>The <dfn id=dom-cva-validity title=dom-cva-validity><code>validity</code></dfn> + attribute must return a <code><a href=#validitystate>ValidityState</a></code> object that + represents the <a href=#validity-states>validity states</a> of the element. This + object is live, and the same object must be returned each time the + element's <code title=dom-cva-validity><a href=#dom-cva-validity>validity</a></code> attribute + is retrieved.<pre class=idl>interface <dfn id=validitystate>ValidityState</dfn> { + readonly attribute boolean <a href=#dom-validitystate-valuemissing title=dom-ValidityState-valueMissing>valueMissing</a>; + readonly attribute boolean <a href=#dom-validitystate-typemismatch title=dom-ValidityState-typeMismatch>typeMismatch</a>; + readonly attribute boolean <a href=#dom-validitystate-patternmismatch title=dom-ValidityState-patternMismatch>patternMismatch</a>; + readonly attribute boolean <a href=#dom-validitystate-toolong title=dom-ValidityState-tooLong>tooLong</a>; + readonly attribute boolean <a href=#dom-validitystate-rangeunderflow title=dom-ValidityState-rangeUnderflow>rangeUnderflow</a>; + readonly attribute boolean <a href=#dom-validitystate-rangeoverflow title=dom-ValidityState-rangeOverflow>rangeOverflow</a>; + readonly attribute boolean <a href=#dom-validitystate-stepmismatch title=dom-ValidityState-stepMismatch>stepMismatch</a>; + readonly attribute boolean <a href=#dom-validitystate-customerror title=dom-ValidityState-customError>customError</a>; + readonly attribute boolean <a href=#dom-validitystate-valid title=dom-ValidityState-valid>valid</a>; +};</pre><p>A <code><a href=#validitystate>ValidityState</a></code> object has the following + attributes. On getting, they must return true if the corresponding + condition given in the following list is true, and false + otherwise.<dl><dt><dfn id=dom-validitystate-valuemissing title=dom-ValidityState-valueMissing><code>valueMissing</code></dfn></dt> + <dd> <p>The control is <a href=#suffering-from-being-missing>suffering from being missing</a>.</p> </dd> + + <dt><dfn id=dom-validitystate-typemismatch title=dom-ValidityState-typeMismatch><code>typeMismatch</code></dfn></dt> + <dd> <p>The control is <a href=#suffering-from-a-type-mismatch>suffering from a type mismatch</a>.</p> </dd> + + <dt><dfn id=dom-validitystate-patternmismatch title=dom-ValidityState-patternMismatch><code>patternMismatch</code></dfn></dt> + <dd> <p>The control is <a href=#suffering-from-a-pattern-mismatch>suffering from a pattern mismatch</a>.</p> </dd> + + <dt><dfn id=dom-validitystate-toolong title=dom-ValidityState-tooLong><code>tooLong</code></dfn></dt> + <dd> <p>The control is <a href=#suffering-from-being-too-long>suffering from being too long</a>.</p> </dd> + + <dt><dfn id=dom-validitystate-rangeunderflow title=dom-ValidityState-rangeUnderflow><code>rangeUnderflow</code></dfn></dt> + <dd> <p>The control is <a href=#suffering-from-an-underflow>suffering from an underflow</a>.</p> </dd> + + <dt><dfn id=dom-validitystate-rangeoverflow title=dom-ValidityState-rangeOverflow><code>rangeOverflow</code></dfn></dt> + <dd> <p>The control is <a href=#suffering-from-an-overflow>suffering from an overflow</a>.</p> </dd> + + <dt><dfn id=dom-validitystate-stepmismatch title=dom-ValidityState-stepMismatch><code>stepMismatch</code></dfn></dt> + <dd> <p>The control is <a href=#suffering-from-a-step-mismatch>suffering from a step mismatch</a>.</p> </dd> + + <dt><dfn id=dom-validitystate-customerror title=dom-ValidityState-customError><code>customError</code></dfn></dt> + <dd> <p>The control is <a href=#suffering-from-a-custom-error>suffering from a custom error</a>.</p> </dd> + + <dt><dfn id=dom-validitystate-valid title=dom-ValidityState-valid><code>valid</code></dfn></dt> + <dd> <p>None of the other conditions are true.</p> </dd> + + </dl><p>When the <dfn id=dom-cva-checkvalidatity title=dom-cva-checkValidatity><code>checkValidity()</code></dfn> + method is invoked, if the element is a <a href=#candidate-for-constraint-validation>candidate for + constraint validation</a> and does not <a href=#concept-fv-valid title=concept-fv-valid>satisfy its constaints</a>, the user + agent must <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-invalid>invalid</code> at the element and return + false. Otherwise, it must only return true without doing anything + else.<p>The <dfn id=dom-cva-validationmessage title=dom-cva-validationMessage><code>validationMessage</code></dfn> + attribute must return the empty string if the element is not a + <a href=#candidate-for-constraint-validation>candidate for constraint validation</a> or if it is one but + it <a href=#concept-fv-valid title=concept-fv-valid>satisfies its constaints</a>; + otherwise, it must return a suitably localised message that the user + agent would show the user if this were the only form with a validity + constraint problem. If the element is <a href=#suffering-from-a-custom-error>suffering from a custom + error</a>, then the <a href=#custom-validity-error-message>custom validity error message</a> + should be present in the return value.<h4 id=form-submission-0><span class=secno>4.10.15 </span>Form submission</h4><!-- XXX http://lxr.mozilla.org/mozilla/source/content/html/content/src/nsHTMLFormElement.cpp --><p>When a form <var title="">form</var> is <dfn id=concept-form-submit title=concept-form-submit>submitted</dfn> from an element <var title="">submitter</var> (typically a button), the user agent must run the following steps:<ol><li id=sandboxSubmitBlocked><p>If <var title="">form</var> is in a <code>Document</code> that has no associated <a href=#browsing-context>browsing context</a> or whose <a href=#browsing-context>browsing context</a> has its
Received on Friday, 10 October 2008 04:33:15 UTC