NOTE: The current preferred location for bug reports is the GitHub issue tracker.
Bug 741 - "Error: Attribute size not allowed on element input at this point."
"Error: Attribute size not allowed on element input at this point."
Status: RESOLVED INTENTIONAL
Product: Validator.nu
Classification: Unclassified
Component: General
HEAD
All All
: P2 normal
Assigned To: Nobody
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-05-05 11:32 CEST by Andreas Kuckartz
Modified: 2010-05-06 16:49 CEST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Kuckartz 2010-05-05 11:32:33 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.
Comment 1 Andreas Kuckartz 2010-05-05 11:41:20 CEST
See also bug 339.
Comment 2 Michael[tm] Smith 2010-05-06 10:06:59 CEST
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
Comment 3 Andreas Kuckartz 2010-05-06 12:58:33 CEST
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/
Comment 4 Michael[tm] Smith 2010-05-06 13:21:02 CEST
(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
Comment 5 Andreas Kuckartz 2010-05-06 16:49:47 CEST
> 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