Re: Is the timing of DOMContentLoaded undefined with respect to external scripts?
<[email protected]> Thu, 22 Sep 2011 00:25:06 -0400
| Newsgroups | gmane.comp.mozilla.devel.dom |
|---|---|
| Message-ID | <[email protected]> |
"Boris Zbarsky" <[email protected]> wrote in message news:[email protected]... > On 9/21/11 11:07 PM, [email protected] wrote: >> I thought it's supposed to be before, but it's after on a simple test >> page. > > DOMContentLoading fires when the parser is done parsing the document. > > Some external scripts block the parser because the might issue > document.write calls. > > Whether an external script blocks the parser or not depends on how it's > inserted into the DOM. > I didn't notice at first that in the page I was looking at (www.google.com/search) the script in question is inserted in a settimeout callback, which certainly explains the difference, from my simple "<script>" test page. Is it the case then that any synchronous, non deferred insertion (whether dom or tag based) would run before DOMContentLoaded?