Skip to content

Conversation

@bluesmoon
Copy link

DOMComplete only reports when all resources referenced by the DOM have been loaded.  There may still be asynchronous resources that have not loaded.  The onload event will block until these resources have been loaded.

DOMComplete only reports when all resources referenced by the DOM have been loaded.  There may still be asynchronous resources that have not loaded.  The onload event will block until these resources have been loaded.
@kaaes
Copy link
Owner

kaaes commented Dec 11, 2012

Hi,

Thank you for taking the time to check that stuff! And sorry for late reply - for some reasons GitHub didn't send me the email with this pull request.

I'm not quite sure however if I understand your point. According to W3C specs here http://www.w3.org/TR/html5/the-end.html#the-end the order is like that:

  • When list of scripts that will execute when the document has finished parsing is empty (step 3) fire DOMContentLoaded (step 4)
  • When set and list of scripts that will execute as soon as possible is empty (steps 5, 6) and there is nothing that delays the load event set the current document readiness to "complete" (step 7.1)
  • Fire load event (step 7.2)

And in this other long link it says:

domComplete attribute - This attribute must return the time immediately before the user agent sets the current document readiness to "complete".

My understanding is that domComplete will fire immediately before load after everything with async/defer was executed i.e at the beginning of the step 7
In that case wouldn't it place async resources between DOMContentLoaded and domComplete?

@bluesmoon
Copy link
Author

There are a few edge cases. For example, if you add a script node in the onreadystatechange handler when ready state is set to complete, that will still delay onload.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants