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

Jukka K. Korpela jkorpela at cs.tut.fi
Mon Mar 7 07:29:17 PST 2011

Mounir Lamouri wrote:

> Note that <input type='time' maxlength='5' size='5'> should work as
> expected given than maxlength and size would just be ignored by a UA
> which knows about the 'time' type and would be used by a UA which
> doesn't.

My point exactly.

> Though, if you want to have a valid HTML code, the best solution is
> probably not to change the HTML specs to accept those attributes given
> that they will be completely useless if the UA support the given
> types.

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.

> 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?

Yucca, http://www.cs.tut.fi/~jkorpela/ 

More information about the whatwg mailing list