W3C home > Mailing lists > Public > whatwg@whatwg.org > March 2007

[whatwg] Apply script.defer to internal scripts

From: Gareth Hay <gazhay@gmail.com>
Date: Thu, 29 Mar 2007 10:30:36 +0100
Message-ID: <98E85503-FEF7-403C-9F6C-D39447C73BD7@gmail.com>
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  
loaded?

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
>
Received on Thursday, 29 March 2007 02:30:36 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:58:54 UTC