[whatwg] Apply script.defer to internal scripts

Kristof Zelechovski giecrilj at stegny.2a.pl
Thu Mar 29 01:51:34 PDT 2007


It is possible to place the script before </body> but having all scripts
within the head is more consistent, logical, better style, whatever.  Except
for the reasons of coding style and clarity, having the script in the head
prevents it from sneaking into the content displayed because the head
element is not rendered.
Weigh these arguments against the advantage of restricting deferred scripts
to external scripts, which is, IMHO, null.
Chris

-----Original Message-----
From: whatwg-bounces at lists.whatwg.org
[mailto:whatwg-bounces at lists.whatwg.org] On Behalf Of Alexey Feldgendler
Sent: Thursday, March 29, 2007 9:25 AM
To: whatwg at whatwg.org
Subject: Re: [whatwg] Apply script.defer to internal scripts

On Thu, 29 Mar 2007 09:19:47 +0200, Kristof Zelechovski  
<giecrilj at stegny.2a.pl> wrote:

>>> The script embedded here is so short and specific that it makes no  
>>> sense
>>> relaying it to an external location; however, if the script is not
>>> deferred, the script fails with an exception at run time because the
>>> document body is not constructed yet.

>> What's wrong with simply placing it after </body>?

> You do not place a script element after the body element:
> 3.6.1. The html element
> Content model:
>     A head element followed by a body element.

Sorry, immediately before </body>.


-- 
Alexey Feldgendler <alexey at feldgendler.ru>
[ICQ: 115226275] http://feldgendler.livejournal.com




More information about the whatwg mailing list