142Re: [jslint] Re: body tag
- Aug 4, 2008The issue I was referring to is that the body tag needs to be
completely loaded before a DOM script runs, especially if you have
something like document.body.appendChild in your script. 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.
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. Putting the script tags in the head is highly inefficient
since it stops the page from loading and can cause a blank screen.
(See Steve Souders book: High Performance Web Sites, O'Reilly, 2007)
On Mon, Aug 4, 2008 at 3:51 PM, Douglas Crockford <douglas@...> wrote:
> --- In email@example.com, "riderpaulpaul" <riderpaul@...> wrote:
>> frameworks have a periodic check to see if the body has loaded using
>> various methods.
>> Since script tags can be in the HTML head (outside the HTML body), why
>> can't one simply place the initiating script tag between [/body] and
>> [/html]. It seems to me like this solves a lot of problems.
>> Semantically it also make sense to place the tag there, rather then in
>> the body that is being manipulated by the script.
> I don't see how it solves anything. There is a lot in the HTML
> recommendations that doesn't make sense, but the requirement that the
> tags all go either into the head or the body seems pretty reasonable.
- << Previous post in topic Next post in topic >>