Loading ...
Sorry, an error occurred while loading the content.

1122Re: [jslint] no comments before html root element?

Expand Messages
  • Mark Volkmann
    Feb 9 2:15 PM
    • 0 Attachment
      On Tue, Feb 9, 2010 at 1:02 PM, Cheney, Edward A SSG RES USAR USARC <
      austin.cheney@...> wrote:

      >
      >
      HTML is not XML
      >

      Right. But XHTML is an that's what I happen to be using. I was hoping that
      JSLint could support my use of XHTML.


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

      Right. The XML recommendation doesn't allow comments before the XML
      declaration (not technically considered a processing instruction), but they
      are allowed before processing instructions that appear in the prolog.

      > 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.
      >
      I think you are considering the XML declaration to be a kind of processing
      instruction, but it isn't. You are correct that comments cannot proceed the
      XML declaration.

      > 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.
      >
      What if you don't have a DOCTYPE? JSLint doesn't allow comments before the
      root element html even if there is no DOCTYPE.

      > 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.
      >
      > Austin
      >
      It seems that JSLint could be modified to allow comments that come after an
      XML declaration (if one is present) and perhaps after a DOCTYPE (if one is
      present), but before the html tag. Are you saying that doing so causes
      problems for a particular web browser?

      --
      R. Mark Volkmann
      Object Computing, Inc.


      [Non-text portions of this message have been removed]
    • Show all 22 messages in this topic