[whatwg] Form Validity Ambiguity - patternMismatch

Mounir Lamouri mounir.lamouri at gmail.com
Tue Apr 20 06:16:10 PDT 2010


On 04/20/2010 08:19 AM, Joseph Pecoraro wrote:
> The section describing the pattern attribute does not explain that
> it only applies to particular input types [1].
> 
> However, one of the tables showing which content attributes apply
> to which input types shows the pattern attribute only applies to
> particular input types. Namely text, search, url, telephone, email,
> and password but not dates, times, numbers, hidden and others:
> 
> This disconnect could lead to ambiguous implementations of
> ValidityState's patternMismatch which is simply described in
> multiple places as:
> 
>   [[
>     When a control has a value that doesn't satisfy the pattern
>     attribute.
>   ]] [3]
>   
> 
>   [[
>     returns true if the element's value doesn't match the provided
>     pattern; false otherwise.
>   ]] [4]
>   
> 
> These two definitions of patternMismatch do not mention that
> they only apply on input type's that the pattern attribute applies
> to. If that is the case then I recommend clarifying that constraint
> in the description of the pattern attribute [1] and when describing
> patternMismatch [3][4]. If that is not that the case then I don't
> see the purpose of the table showing that the "pattern" attribute
> only applies to particular input types, and I would like clarification
> there (like the row being removed or all checkboxes?) [2].
> 
> This may also apply to other validity states as well, I haven't
> checked others yet.
> 
> Cheers!
> - Joe
> 
> [1]: http://www.whatwg.org/specs/web-apps/current-work/multipage/common-input-element-attributes.html#attr-input-pattern
> [2]: http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#the-input-element
> [3]: http://www.whatwg.org/specs/web-apps/current-work/multipage/association-of-controls-and-forms.html#suffering-from-a-pattern-mismatch
> [4]: http://www.whatwg.org/specs/web-apps/current-work/multipage/association-of-controls-and-forms.html#the-constraint-validation-api
> 

Actually, if you are looking for something more normative (the table is
non-normative), at the end of each input element states description, you
can found the list of attributes which apply/don't apply. AFAIK, the
attributes/methods never mention in which states they apply. I suppose
it is to prevent mentioning things twice thus doubling the needed
changes and the chances of incoherence/mistakes.

--
Mounir



More information about the whatwg mailing list