[whatwg] Apply script.defer to internal scripts

Kristof Zelechovski giecrilj at stegny.2a.pl
Thu Mar 29 00:19:47 PDT 2007


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.
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 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




More information about the whatwg mailing list