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

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

Expand Messages
  • Mark Volkmann
    On Thu, Feb 11, 2010 at 3:21 AM, Cheney, Edward A SSG RES USAR USARC ... The HTML 4.01 Recommendation makes this very clear in section 7.1. See
    Message 1 of 22 , Feb 11, 2010
    • 0 Attachment
      On Thu, Feb 11, 2010 at 3:21 AM, Cheney, Edward A SSG RES USAR USARC
      <austin.cheney@...> wrote:
      >
      > > You asserted that the OP was "wrong" in his assessment (that they
      > > are valid), so I'll repeat my request for a source, or at least an
      > > example to support your position.
      >
      > If my answers to my opinions cannot be found in a standards specification or a commonly accepted best practices guidance they are formed from personal experience. Some of my personal XML experience is best not supplied here, but some of those works are online.

      The HTML 4.01 Recommendation makes this very clear in section 7.1.
      See http://www.w3.org/TR/1999/REC-html401-19991224/
      Here's what it says:

      "7.1 Introduction to the structure of an HTML document

      An HTML 4 document is composed of three parts:

      a line containing HTML version information,
      a declarative header section (delimited by the HEAD element),
      a body, which contains the document's actual content. The body may be
      implemented by the BODY element or the FRAMESET element.

      White space (spaces, newlines, tabs, and comments) may appear before
      or after each section."

      The last sentence says that comments can go anywhere. The only reason
      I can see for JSLint to not allow comments anywhere is if that causes
      a problem for a specific browser. If that's the case then I'd like to
      know which browsers have the issue.

      --
      R. Mark Volkmann
      Object Computing, Inc.
    • Cheney, Edward A SSG RES USAR USARC
      ... The root element is not one of three sections that you stated in accordance with para 7.1 of HTML 4.
      Message 2 of 22 , Feb 12, 2010
      • 0 Attachment
        > White space (spaces, newlines, tabs, and comments) may appear before
        > or after each section."

        The root element is not one of three sections that you stated in accordance with para 7.1 of HTML 4.
      • Mark Volkmann
        On Fri, Feb 12, 2010 at 5:01 AM, Cheney, Edward A SSG RES USAR USARC
        Message 3 of 22 , Feb 12, 2010
        • 0 Attachment
          On Fri, Feb 12, 2010 at 5:01 AM, Cheney, Edward A SSG RES USAR USARC <
          austin.cheney@...> wrote:

          >
          >
          > > White space (spaces, newlines, tabs, and comments) may appear before
          > > or after each section."
          >
          > The root element is not one of three sections that you stated in accordance
          > with para 7.1 of HTML 4.
          >

          How about "a line containing HTML version information". Isn't that the
          DOCTYPE? Isn't that before the root element?

          --
          R. Mark Volkmann
          Object Computing, Inc.


          [Non-text portions of this message have been removed]
        • Cheney, Edward A SSG RES USAR USARC
          Yes, putting anything, except whitespace characters, alters how several browsers perceive rendering of the DOM. This is most noticable in IE with regard to
          Message 4 of 22 , Feb 12, 2010
          • 0 Attachment
            Yes, putting anything, except whitespace characters, alters how several browsers perceive rendering of the DOM. This is most noticable in IE with regard to complicated CSS processing, but can be noticed in other browsers under certain circumstances. Here is a good example:

            http://www.travelocity.com/mediakit/index.html

            That code is standards compliant and uses the transitional doctype. It can support up to XHTML 1.0 Strict immediately and XHTML 1.1 with the removal of the "lang" attribute and changing the mime type in both the document head and the HTTP header. The code can be executed locally if an absolute URI is supplied for the CSS source. Put a comment in various strange places into the code and reload it locally to see if the page is rendered differently. Please keep in mind this is simple code containing a few elements and a limited heirarchy. The results are different when the DOM becomes more complicated in either variety and/or heirarchy. I have not tested scripted response to the altered DOM rendering. I would guess, I have not tested this at all, that reading from the DOM would be lesser altered that supplying to the DOM using DOM methods.

            Since comments are nodes in the DOM it only seems logic that they should not exist prior to the root element or after the root's closing element if to be logically referenced in an automated scheme without reliance on an ad hoc approach.

            Austin
          • Mark Volkmann
            On Fri, Feb 12, 2010 at 5:56 AM, Cheney, Edward A SSG RES USAR USARC
            Message 5 of 22 , Feb 12, 2010
            • 0 Attachment
              On Fri, Feb 12, 2010 at 5:56 AM, Cheney, Edward A SSG RES USAR USARC <
              austin.cheney@...> wrote:

              >
              >
              > Yes, putting anything, except whitespace characters, alters how several
              > browsers perceive rendering of the DOM. This is most noticable in IE with
              > regard to complicated CSS processing, but can be noticed in other browsers
              > under certain circumstances. Here is a good example:
              >
              > http://www.travelocity.com/mediakit/index.html
              >
              > That code is standards compliant and uses the transitional doctype. It can
              > support up to XHTML 1.0 Strict immediately and XHTML 1.1 with the removal of
              > the "lang" attribute and changing the mime type in both the document head
              > and the HTTP header. The code can be executed locally if an absolute URI is
              > supplied for the CSS source. Put a comment in various strange places into
              > the code and reload it locally to see if the page is rendered differently.
              > Please keep in mind this is simple code containing a few elements and a
              > limited heirarchy. The results are different when the DOM becomes more
              > complicated in either variety and/or heirarchy. I have not tested scripted
              > response to the altered DOM rendering. I would guess, I have not tested this
              > at all, that reading from the DOM would be lesser altered that supplying to
              > the DOM using DOM methods.
              >
              I wish you were able to provide a simple example and tell me exactly what I
              should see that is wrong in a specific browser. I'd gladly drop this
              discussion and be in favor of the current JSLint restriction if you could do
              that.

              > Since comments are nodes in the DOM it only seems logic that they should
              > not exist prior to the root element or after the root's closing element if
              > to be logically referenced in an automated scheme without reliance on an ad
              > hoc approach.
              >
              Why do you feel that is logical? The root element is a child of the DOM
              Document object. Comments before or after the root element are children of
              the DOM Document object.

              --
              R. Mark Volkmann
              Object Computing, Inc.


              [Non-text portions of this message have been removed]
            • Cheney, Edward A SSG RES USAR USARC
              I am sorry, but it is not that simple. If you place a comment above the doctype and refresh the page in IE the rendering changes are obvious. In many other
              Message 6 of 22 , Feb 12, 2010
              • 0 Attachment
                I am sorry, but it is not that simple. If you place a comment above the doctype and refresh the page in IE the rendering changes are obvious. In many other browsers problems may be present, but can be diffecult to identify if any problems actually exist. The idea in that example is that it is a perfect test sample since extremely simple HTML with extremely complicated CSS. Placing a comment above the doctype makes for a more obvious test, but placing a comment between the doctype and the root element may not make for an obvious test on display and may only become obvious when attempting to gather the comment as a node in the DOM.

                > Why do you feel that is logical? The root element is a child of the DOM
                > Document object.

                The logic, or my logic, is inherent to my experience writing schema and representation of a node tree there in. This logic of mine is exemplified by some feature I have developed that may or may not extend what is a document object, and I am not willing to harm you through receipt of unintended disclosure.

                Austin
              • Mark Volkmann
                I don t want to place a comment above the DOCTYPE. This is what I want to do: some
                Message 7 of 22 , Feb 12, 2010
                • 0 Attachment
                  I don't want to place a comment above the DOCTYPE. This is what I want to
                  do:

                  <!DOCTYPE html whatever>
                  <!-- some comment -->
                  <html>
                  <head>
                  <title>some title</title>
                  </head>
                  <body>
                  </body>
                  </html>

                  You are asking me to just trust you because you say you have seen this cause
                  a problem in a past project but it seems that you can't demonstrate the
                  issue or point to any "standard" that says its a bad idea. I guess I'm not
                  enough of a trusting person. ;-) I'd really like to see an example of the
                  problem that occurs when a comment is placed between the DOCTYPE and the
                  html root element.

                  On Fri, Feb 12, 2010 at 10:56 AM, Cheney, Edward A SSG RES USAR USARC <
                  austin.cheney@...> wrote:

                  >
                  >
                  > I am sorry, but it is not that simple. If you place a comment above the
                  > doctype and refresh the page in IE the rendering changes are obvious. In
                  > many other browsers problems may be present, but can be diffecult to
                  > identify if any problems actually exist. The idea in that example is that it
                  > is a perfect test sample since extremely simple HTML with extremely
                  > complicated CSS. Placing a comment above the doctype makes for a more
                  > obvious test, but placing a comment between the doctype and the root element
                  > may not make for an obvious test on display and may only become obvious when
                  > attempting to gather the comment as a node in the DOM.
                  > > Why do you feel that is logical? The root element is a child of the DOM
                  > > Document object.
                  >
                  > The logic, or my logic, is inherent to my experience writing schema and
                  > representation of a node tree there in. This logic of mine is exemplified by
                  > some feature I have developed that may or may not extend what is a document
                  > object, and I am not willing to harm you through receipt of unintended
                  > disclosure.
                  >
                  > Austin
                  >

                  --
                  R. Mark Volkmann
                  Object Computing, Inc.


                  [Non-text portions of this message have been removed]
                • Cheney, Edward A SSG RES USAR USARC
                  Not exactly. I am saying I have seen in past projects how this condition is potentially problematic when the technology is pushed beyond current
                  Message 8 of 22 , Feb 12, 2010
                  • 0 Attachment
                    Not exactly. I am saying I have seen in past projects how this condition is potentially problematic when the technology is pushed beyond current implementations. In other words, there are use cases, not previously considered in the most current DOM specification, that when applied in an instance appear to be problematic in this condition.

                    > I guess I'm not enough of a trusting person.
                    I can demonstrate this potentially problematic condition, but I have already mentioned I will not harm you with such a demonstration. If such harm is of no concern then simply contact the legal department of Sabre Holdings and ask permission to examine IP attached to my name. I do not own the IP and you must volunteer to an administering party to receive disclosure. Otherwise you would have to find the related contents online and examine them independently of any assistance from me.

                    At this point I believe the discussion has the field of association to the JSLint tool and if the discussion is to continue then I ask that you please contact me directly and only after contacting my legal representatives. Until such I cannot continue this conversation.
                  Your message has been successfully submitted and would be delivered to recipients shortly.