Upon defer attirbute MDN says:
This Boolean attribute is set to indicate to a browser that the script is meant to be executed after the document has
DOMContentLoaded
can be fired before CSSOM, source
The domContentLoaded event fires shortly after the HTML is parsed; the browser knows not to block on JavaScript and since there are no other parser blocking scripts the CSSOM construction can also proceed in parallel.
Article on Google Developer describes async
instead of defer
but in the case of your question, it doesn't change anything because based on Steve Sourders article on perfplanet
DEFER scripts execute after DOM Interactive.
and his comment under his article
[...] the spec says that DEFER scripts run after
domInteractive
but beforedomContentLoaded
.
You can make your own experiment, look below for code using defer
and timeline
JS Bin
App