Bugzilla – Bug 741
"Error: Attribute size not allowed on element input at this point."
Last modified: 2010-05-06 16:49:47 CEST
I see this error report: "Error: Attribute size not allowed on element input at this point." for this HTML-code: <input type="number" style="background-color:F5F5F5;width:40px;" name="tpi_input" id="tpi_input" value="120" size="20"> As far as I understand it "size" is allowed for "input"-elements. *** One additional suggestion: I would prefer Error: Attribute "size" not allowed on element "input" at this point. to Error: Attribute size not allowed on element input at this point.
See also bug 339.
Hi Andreas, Whether the size attribute is allowed on a particular input element depends on the value of the type attribute on the input element. The HTML5 spec does not allow it on type=number (it's only allowed if the value is text, password, email, url, search, or tel). So the validator.nu behavior for this case conforms to the current spec
Thanks. I now agree that "validator.nu behavior for this case conforms to the current spec". I had not expected such a backwards compatibility problem. I think that this is a problem in the specification because (as far as I know) legacy browsers do not know what to do with min and max attributes. So I either use input-type text with the size attribute which is supported by legacy browsers and HTML5 or I use inputtype number which is supported by HTML5 but where the size can not be specified. This makes it difficult to migrate from old-HTML to HTML5. Maybe this can be forwarded to those who care about this aspect of the specification? I agree with what someone else wrote on that problem: "A) What happens when your type=number has no min or max but you know how many digits it should fit? B) What happened to backwards compatibility? HTML5 inputs were supposed to be backwards compatible. type=number inputs fall back to type=text inputs when the browser has not implemented number inputs yet. text input size has always been controlled using size= (and css of course) and min/max/step values will have no effect on browsers that haven't implemented number. So if type=number is supposed to fallback to type=text why is it that including a size= attribute so that the text fallback doesn't get insanely long makes your html5 document invalid? Shouldn't size= be listed as "do not apply" rather than "must not be specified, ..."?" http://blog.danielfriesen.name/2010/04/20/html5-number-input-implementation-flops/
(In reply to comment #3) > Maybe this can be forwarded to those who care about this aspect of the > specification? I'd suggest it'd be best if you could file a bug for it directly yourself; you can do that here: http://www.w3.org/Bugs/Public/enter_bug.cgi?product=HTML%20WG&component=HTML5%20spec%20%28editor%3A%20Ian%20Hickson%29&priority=P3
> I'd suggest it'd be best if you could file a bug for it directly yourself; Thanks again. I have just done that: http://www.w3.org/Bugs/Public/show_bug.cgi?id=9670