Re: Is the timing of DOMContentLoaded undefined with respect toexternal scripts?
<[email protected]> Thu, 22 Sep 2011 04:59:39 -0400
| Newsgroups | gmane.comp.mozilla.devel.dom |
|---|---|
| Message-ID | <[email protected]> |
"Henri Sivonen" <[email protected]> wrote in message news:[email protected]... > On Thu, Sep 22, 2011 at 8:42 AM, <[email protected]> wrote: >> only synchronous, non-deferred <script> tags block the parser and so run >> before DOMContentLoaded. > > Deferred scripts (parser-inserted <script defer src=foo.js></script>) > execute before DOMContentLoaded fires. > I'm not seeing this (Fx 7.0b6): ___________________________________ <script> function handler(e) { console.log(e.type + ':' + e.target); } document.addEventListener('load', handler, true); document.addEventListener('DOMContentLoaded', handler, false); </script> <script defer src="script.js"></script> ___________________________________ both the script itself and its load handler log after 'DOMContentLoaded' Should it be before? Why?