[whatwg] Apply script.defer to internal scripts

Gareth Hay gazhay at gmail.com
Thu Mar 29 02:30:36 PDT 2007

Does it not follow that to be "more consistent, logical, better  
style, whatever." you should wrap your code in a function that is  
called onload?

Isn't that what onload is for? being triggered after the page has  

On 29 Mar 2007, at 09:51, Kristof Zelechovski wrote:

> 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