[whatwg] size content attribute on <input type=number>

Aryeh Gregor Simetrical+w3c at gmail.com
Sun Sep 6 18:51:52 PDT 2009


The current spec prohibits input elements in the Number state from
having the size attribute:

http://www.whatwg.org/specs/web-apps/current-work/multipage/forms.html#number-state

I don't see the reason for this.  It seems at least as likely that the
author would like to provide a hint for the length of a number field
as, say, a URL field.  Users are likely to only want to submit one- or
two-digit numbers in some cases, and decimal numbers with very high
precision in other cases.  It would be reasonable to have size=3 for
an "age" field, for instance, but a much larger size for a field in a
scientific application.  Of course, if the UA provides an input
mechanism that doesn't resemble a text box, it might not be relevant
to that particular UA, but a text-boxy thing is a logical way to
implement type=number, and in fact that's how Opera does it.

Also note that even when UAs are expected to implement special input
mechanisms where specifying size doesn't make sense, it could still be
useful to specify a size to get more graceful fallback in older
browsers.  The default <input> size in most browsers is likely quite a
lot larger than necessary to specify a time, for instance.  It's worth
considering allowing size for all the new input types for that reason.

Personally I wouldn't object if the size attribute were scrapped
entirely in favor of CSS, since it seems basically presentational to
me.  But if it's present, I don't see why it's not as appropriate for
number as anything else.



More information about the whatwg mailing list