1121Re: [jslint] no comments before html root element?
- Feb 9, 2010HTML is not XML and is processed as XML less than .0001% of the time across the web. As such your comments regarding XML are irrelevant. Nowhere does the JSLint tool to claim to support or process XML in any form. Furthermore it is very bad practice to include comments prior to the initial XML processing declarations as this can quite likely interfere with XML processing when vocabularies from multiple separate definitions are included in a single XML instance. It is my recommendation that comments should not come before any XML processing declaration since the XML processing declarations always go at the top of the document.
It is not valid to include comments prior to the doctype declaration in a HTML 4 or XHTML1.x document. The specifications say nothing to this effect, but it should be presumed that processing declarations must be first explicitly in an HTML document, or in the case of XHTML the XML processing declarations must precede the SGML processing declarations. Failure to comply results in altered rendering of the DOM in various different browsers, where such an alteration is contrary to standards compliance and cross browser conformity. In IE this phenomenon is defined as quirks mode and while most obvious to IE other browsers exhibit such behaviors less dramatically. As a result never include comments prior to the doctype. Compare the implications of such violations in your own testing.
Furthermore, it is bad practice to rely upon a source that may or may not differ from the language of the technologies' conformance specifications except where rules of best practice are concerned in the absence of specifics or conflict to standards language.
Finally, browsers are sloppy. Everything in HTML processing is acceptable until its not, but that has absolutely no bearing on validity. That is why there are standards. Please do not confuse acceptability for validity.
- << Previous post in topic Next post in topic >>