[whatwg] DOMContentLoaded, load and current document readiness

James Graham jgraham at opera.com
Thu Aug 30 07:57:53 PDT 2012

On 08/30/2012 04:45 PM, Jonas Sicking wrote:
> On Thu, Aug 30, 2012 at 11:30 AM, Ian Hickson <ian at hixie.ch> wrote:

>>> That's not what I'm suggesting. I'm suggesting that <script defer
>>> src="..."> and <script defer> elements appearing in the markup and
>>> parsed by the parser should always run before DOMContentLoaded firing.
>>> This appears to be what Firefox does, and I would expect that the web
>>> depends on this. For example I would expect defered to contain
>>> document.write which should not blow away the current page.
>> That's what the spec says, no?
> I thought so, but the comments in this thread made me think otherwise.
> If that's the case then I'm happy.

Unless I am horribly misreading the spec [1], <script defer src> will 
run before DOMContentLoaded, <script async src> and, depending on how it 
was created, <script src> may run after DOMContentLoaded and both 
<script defer> and <script async> are like plain <script> (i.e. these 
attributes apply only to external scripts).

[1] http://www.whatwg.org/specs/web-apps/current-work/#the-end

More information about the whatwg mailing list