[whatwg] Allowing size and maxlength attributes for all new input types would provide better fallbacks

On 03/07/2011 04:29 PM, Jukka K. Korpela wrote:
> Current W3C Recommendations, as well ISO HTML, allow the maxlength and
> size attribute in an <input> element, irrespective of what the type
> attribute value is. I am not proposing a change to that. On the
> contrary, I am proposing that they be allowed, because disallowing them
> would partly break the fallback idea for no good reason.
> 
> And they need not be completely useless if the UA supports the given
> types. I don't see any reason why a UA could not implement, say, <input
> type="time"> as a text box, provided of course that it checks the input
> value as required. I see no problem with the size attribute here. The
> maxlength attribute might seen as potentially problematic, as <input
> type="time" maxlength="5"> could limit the input so that it only
> contains hours and minutes, not seconds. But I don't see that as a big
> problem.

I think you are mixing two issues here (or I am):
- <input type='time' size='5'> should be valid and might actually do
something when the UA supports type='time' ;
- <input type='time' size='5'> should be valid so it can be set for
legacy browsers.

I have no strong opinions against the former issue: I would agree that
an implementation might follow the specs without a date picker. Such
implementation could use the size attribute.

I'm commenting the later issue below.

>> However, I think the web page should set the attributes in a
>> compat check in javascript.
> 
> It sounds like an unnecessarily complicated and unreliable (Javascript
> might be off) way of doing something fairly simple that authors have
> done (almost) since the dawn of the Web. Old browsers will be happy to
> honor the attributes and new browsers may ignore them (or choose to
> honor them), so why should we need to take a long route?

My answer was actually assuming that you did want to pass
http://validator.nu/. And <input type='time' size='5'> isn't valid. In
that case, you can't simply write <input type='time' size='5'> in the
HTML code. My answer was also assuming that you were expecting <input
type='time'> to show a date picker widget and you did want to provide
your own date picker widget when type='time' wasn't supported by the
browser. In that case, you need some javascript.
I don't think you can sanely expect to fully support legacy browsers if
you use HTML5 Forms without javascript. By "fully support" I mean giving
(more or less) the same level of functionality.

--
Mounir

Received on Wednesday, 9 March 2011 17:12:39 UTC