[whatwg] Web Forms attributes: minlength / autocomplete

Sander html5 at zoid.nl
Wed Jun 6 19:07:18 PDT 2007


Thomas Broyer schreef:
>> <...> Even though there
>> are only 5 characters... if it has no meaning to someone they can easily
>> make mistakes: "{3,}." or ",{3.}". Easy as it is, this stuff is
>> abrcadabra to a lot of authors.
>
> Given that:
>   If the pattern given by the attribute specifies a pattern that is
> incompatible with the grammar of the control type, as in the example
> below, then the control could never be satisfied.
> those authors will immediately see their mistake.
> This is the same reasoning as behind:
>   The requirement that the pattern match the entire string is present
> because it is expected that the overwhelming majority of use cases
> will be to require that user input exactly match the given pattern.
> Authors who forget that these characters are implied will immediately
> realise their mistake during testing. Had the characters not been
> implied, requiring most authors to insert them themselves, it is
> likely that authors who forgot them would not catch their mistake as
> easily.

True, authors will probably notice there is something wrong (a maxlength 
that was supposed to be a minlength or another mistake), but that 
doesn't mean they know how to correct this mistake.

The 'fun' thing is that here the specs take the strict/rigid route in 
order to make things more clear for the authors, but on other occasions 
a loose aproach is chosen for exactly the same reason as 'strict' would 
make things harder.


> HTML5 tries to add attributes (and elements) only when really needed.

Well, you might wonder whether <input type="range"> adds something to 
type="number" that is really needed.


> Authors have survived the lack of minlength in HTML4, why couldn't
> they survive its lack in HTML5 too? They're not forced to use pattern=
> after all (particularly if they don't understand it).

They even survived the lack of HTML5. Still, we're discussing its 
features ;-)

Authors that want to define a minimal length are (=will be) in fact 
forced to use the pattern attribute according to the current specs.


> You're not forced to use new features of HTML5 ;-)
You don't know my boss. As soon as he finds out about things like the 
<canvas> element, or the new Web Forms features... oh boy.


> And I'm not at all against a minlength= attribute either.
You have a strange way of showing that ;-)

> I just try
> to find arguments to resist adding yet another attribute to HTML ;-)
> Seriously, I try to give arguments that might have already been given
> (I don't know, maybe minlength= was already requested some day) and
> would have lead to what's in the spec today (i.e. no minlength=
> attribute)
But why, if you're _not at all_ against it?

I'm not sure either whether this was requested earlier already. And I 
think I know what the arguments against it are and I believe to 
understand the logics underneath them. But it's for the sake of the 
authors that I request this feature as I believe that regular 
expressions are just too complicated for most of them.


cheers,
Sander




More information about the whatwg mailing list