[whatwg] size content attribute on <input type=number>
ian at hixie.ch
Mon Sep 14 04:29:55 PDT 2009
On Sun, 6 Sep 2009, Aryeh Gregor wrote:
> The current spec prohibits input elements in the Number state from
> having the size attribute:
> 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.
Use the min, max, and step attributes to specify the range, then the UA
can automatically determine the size.
> 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.
That's an interesting idea. In practice, though, I think people will have
much more elaborate fallback than just text -- using script -- so that the
size="" attribute isn't that important for this purpose. When no script is
available, the default size is fine, IMHO. I'd rather make the conformance
criteria be forward-looking here.
Ian Hickson U+1047E )\._.,--....,'``. fL
http://ln.hixie.ch/ U+263A /, _.. \ _\ ;`._ ,.
Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'
More information about the whatwg