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

[whatwg] Apply script.defer to internal scripts

From: Kristof Zelechovski <giecrilj@stegny.2a.pl>
Date: Thu, 29 Mar 2007 09:19:47 +0200
Message-ID: <004701c771d2$a2816b90$1a01080a@POCZTOWIEC>
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.

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

On Tue, 27 Mar 2007 21:49:41 +0200, Kristof Zelechovski  
<giecrilj at stegny.2a.pl> wrote:

> Consider the following example:
> <script type="text/javascript" defer>
> function ha8validate(p5event) { return true }
> document.forms[0].onsubmit = ha8validate
> </script>
> 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>?

Alexey Feldgendler <alexey at feldgendler.ru>
[ICQ: 115226275] http://feldgendler.livejournal.com
Received on Thursday, 29 March 2007 00:19:47 UTC

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