- From: Jukka K. Korpela <jkorpela@cs.tut.fi>
- Date: Fri, 25 Jul 2014 15:31:39 +0300
- To: Edward Vassar <ervassar@gmail.com>, www-validator@w3.org
2014-07-23 3:02, Edward Vassar wrote: > A piece of html that I wrote provoked the validation service to flag a > plythera of errors of 3 types. Generally, you should include a URL of the document. > None of the flagged "errors" > seem to prevent desired code execution. They point out that the effects may differ from what you expect, > First error type involved using "size attribute for input types file and > number: Error/Line 20 <http://validator.w3.org/check#line-20>, Column > 84/: Attribute size not allowed on element input at this point. > > |actual code:|<input type="file" id="approvalInputTypeFile" multiple accept="image/*" size="80"> The size attribute in such an element has had different definitions in specifications and different implementations in browsers. This is why it has been removed from HTML5, which appears to be what you are validating against. > <!--validate doesn't like using size if type is file, but how else control the field size --> It is expected to be controlled by the browser. It depends on the implementation whether there is a file name box at all and what the file name syntax there is, hence how wide it needs to be. But you can set the width of the element in CSS. > likewise for <input type="number" id="numImageId" size="3" value="6" > min="1"> <!--validate doesn't like using size if type is number, but how > else control the field size --> Similarly, the browser is expected to present some kind of widget for numeric input. For numbers, you are not expected to specify the length in characters but the limits, e.g. max="999". However, the validator is in error. It should not issue an error message, but a warning. Using the size attribute in this context is explicitly declared as conforming, though obsolete: http://www.w3.org/html/wg/drafts/html/master/single-page.html#obsolete-but-conforming-features Note that HTML5 validation is experimental, HTML5 itself is work in progress, and there is no definitive statement about the version of HTML5 that the validator checks against. I have mentioned an HTML 5.1 Nightly URL above, since the validator's error messages refer to that version of HTML5. > The other two errors were objections to <img>s with no src or alt. They have long been required in HTML. HTML5 has some debatable statements about alt not being required in all contexts, but they are best ignored. > My > HTML supplied placeholder <img> locations. The JS supplied the actual > src and alt for each location that was utilized at any particular point > in time. This means that when scripting is disabled, there are dysfunct <img> elements. Browsers may render them in various ways; there are no strict rules for such error handling. So you should either fill in such values that the page makes some sense when they are actually used (when scripting is disabled), or generate and insert the img elements with JavaScript. You don't need an invalid dummy <img> tag, when you can just document.createElement('img') etc. Yucca
Received on Friday, 25 July 2014 12:32:14 UTC