[whatwg] Web Forms attributes: minlength / autocomplete

2007/6/6, Sander:
>
> Thomas Broyer schreef:
> >
> > Yes, minlength could be handy, but pattern=".{3,}" is not that
> > difficult (equivalent to minlength=3 here).
>
> I see it's not really difficult, that's true (as I said before, I don't
> know much about regular expressions). But as I more than once heard the
> arguments that we must avoid as much possibilities for authors to get it
> wrong and that HTML authoring must be not for professionals only (as in
> the discussion why HTML parsers should not be as rigid as XML parsers),
> I wonder if pattern=".{3,}" passes those arguments. 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.

> > maxlength was already in HTML4, so (i guess) it's kept merely for
> > backwards compatibility, but is actually equivalent to a
> > pattern=".{,N}" where N is the maxlength value.
> > minlength doesn't exist, and given that you can achieve the same
> > effect using a pattern (see above), there's no real reason to
> > introduce yet another attribute.
>
> Easy as these 2 formats may be, and given the fact that we keep
> maxlength, why not add minlength? It's more logical, combined with
> maxlength and it's a lot easier to use, with less possibilities to make
> mistakes.
> So, the real reason would be to make life easier for auhors, most of who
> don't know anything about regular expressions.

HTML5 tries to add attributes (and elements) only when 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).

> For all kinds of applications that would indeed be a better solution,
> but for a lot of sites and authors that's not necessary and that pattern
> is just way too complicated.

You're not forced to use new features of HTML5 ;-)

> I guess I forget to mention I'm not at all against the pattern attribute
> either. I think it adds great possibilities. It's just that its values
> can not be read or written by most authors.

And I'm not at all against a minlength= attribute either. 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)

-- 
Thomas Broyer

Received on Wednesday, 6 June 2007 08:42:37 UTC