Source:Mozilla_developer_network The DOMContentLoaded event fires when the HTML document has been completely parsed, and all deferred scripts (
DOMContentLoaded does not wait for stylesheets to load, however deferred scripts do wait for stylesheets, and DOMContentLoaded queues behind deferred scripts. Also, scripts which aren’t deferred or async (e.g. <script>) will wait for already-parsed stylesheets to load.
The original target for this event is the Document that has loaded. You can listen for this event on the Window interface to handle it in the capture or bubbling phases. For full details on this event please see the page on the Document: DOMContentLoaded event.
A different event, load, should be used only to detect a fully-loaded page. It is a common mistake to use load where DOMContentLoaded would be more appropriate.