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

RE: [jslint] JSLinting HTML document with HTML comment at start

Expand Messages
  • Rob Richardson
    A comment before the DOCTYPE sends all versions of IE into quirks mode, defeating the purpose of the doctype you ve specified. See
    Message 1 of 7 , Jan 16, 2012
    • 0 Attachment
      A comment before the DOCTYPE sends all versions of IE into quirks mode,
      defeating the purpose of the doctype you've specified. See
      http://stackoverflow.com/questions/941100/can-html-comments-appear-before-th
      e-doctype-declaration Move the DOCTYPE line above the comment and you'll be
      fine. It's unfortunate the error message doesn't include this clarity.

      Rob


      -----Original Message-----
      From: jslint_com@yahoogroups.com [mailto:jslint_com@yahoogroups.com] On
      Behalf Of cse_html_validator
      Sent: Monday, January 16, 2012 7:31 AM
      To: jslint_com@yahoogroups.com
      Subject: [jslint] JSLinting HTML document with HTML comment at start



      It seems JSLint cannot check an HTML document if there is an HTML comment at
      the beginning of the document. Can this be fixed or is there a way around
      it?

      For example:
      <!-- test -->
      <!DOCTYPE html>
      <html>
      <head>
      <title></title>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta
      name="generator" content="CSE HTML Validator Professional
      (http://www.htmlvalidator.com/)"> </head><body></body></html>

      Generates:
      Problem: Unexpected '--'.

      Thank you.
    • cse_html_validator
      ... Thanks for the information on using comments before the DOCTYPE. However, it seems there is no solution to this if one decides they want or need to use
      Message 2 of 7 , Jan 31, 2012
      • 0 Attachment
        --- In jslint_com@yahoogroups.com, "Rob Richardson" <erobrich@...> wrote:
        >
        > A comment before the DOCTYPE sends all versions of IE into quirks mode,
        > defeating the purpose of the doctype you've specified. See
        > http://stackoverflow.com/questions/941100/can-html-comments-appear-before-th
        > e-doctype-declaration Move the DOCTYPE line above the comment and you'll be
        > fine. It's unfortunate the error message doesn't include this clarity.
        >
        > Rob

        Thanks for the information on using comments before the DOCTYPE.

        However, it seems there is no solution to this if one decides they want or need to use comments before the DOCTYPE? Is there anyway to tell JSLint to accept it?

        Albert
      • cse_html_validator
        Also, what if the comment is a server macro or something that will be processed by the server so it doesn t show up to the end user? Is JSLint useless for this
        Message 3 of 7 , Jan 31, 2012
        • 0 Attachment
          Also, what if the comment is a server macro or something that will be processed by the server so it doesn't show up to the end user? Is JSLint useless for this case? I would hope not.


          >
          > Thanks for the information on using comments before the DOCTYPE.
          >
          > However, it seems there is no solution to this if one decides they want or need to use comments before the DOCTYPE? Is there anyway to tell JSLint to accept it?
          >
          > Albert
          >
        • Sean Kelly
          Personally, I prefer to fix my code to follow JSLint s recommendations. That said, I also put all my Javascript in .js files and include them using script tags
          Message 4 of 7 , Feb 1 2:12 PM
          • 0 Attachment
            Personally, I prefer to fix my code to follow JSLint's recommendations.
            That said, I also put all my Javascript in .js files and include them using
            script tags so JSLint does not check my HTML, it checks my JavaScript.

            SeanK

            On Tue, Jan 31, 2012 at 3:47 PM, cse_html_validator <alhome@...>wrote:

            > **
            >
            >
            >
            > Also, what if the comment is a server macro or something that will be
            > processed by the server so it doesn't show up to the end user? Is JSLint
            > useless for this case? I would hope not.
            >
            > >
            > > Thanks for the information on using comments before the DOCTYPE.
            > >
            > > However, it seems there is no solution to this if one decides they want
            > or need to use comments before the DOCTYPE? Is there anyway to tell JSLint
            > to accept it?
            > >
            > > Albert
            > >
            >
            >
            >


            [Non-text portions of this message have been removed]
          Your message has been successfully submitted and would be delivered to recipients shortly.