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

143Re: [jslint] Re: body tag

Expand Messages
  • Andy Stevens
    Aug 5, 2008
    • 0 Attachment
      2008/8/5 Paul de Jong <riderpaul@...>:
      > The issue I was referring to is that the body tag needs to be
      > completely loaded before a DOM script runs,

      Not always, I have inline scripts that work just fine so long as the
      parts of the DOM they are manipulating are ready & available.

      > especially if you have
      > something like document.body.appendChild in your script.

      Seems reasonable to me that the body should be complete before you add to it.

      > Having the
      > script in the body means one needs to do complicated DOM checking to
      > make sure the body is loaded before the script runs...or at least set
      > a arbitrary delay in the hopes that the end of the body will get
      > processed in that time.

      How complicated is <body
      onload="finished_loading_so_call_the_script_now()"> anyway?

      > It seems weird to put the script tag inside the body tag, when
      > logically it should come after it. I was just wondering if there was
      > some reason other then the one you stated.
      > I have never encountered a problem putting the script tag after the
      > body tag.

      Hey, if it works for you then go for it. So long as you don't care
      about your HTML being invalid according to the DTD, so it may break
      unexpectedly in future browser versions. If you care so much, you can
      also join the HTML 5 discussions and try to get it added to the spec.

      What does any of this have to do with JSLint, though? Are you saying
      that your inline script isn't being checked if it's not inside the
      head or body tags?

    • Show all 5 messages in this topic