The HTML living standard published by WHATWG, specifies the order of actions that happen when the DOM has been parsed. It has 12 steps. Steps 4 and 7 deal with the events you ask about:
4) Queue a task to run the following substeps:
Fire an event named DOMContentLoaded
at the Document object, with its bubbles attribute initialized to true.
Enable the client message queue of the ServiceWorkerContainer object whose associated service worker client is the Document object's relevant settings object.
5) Spin the event loop until the set of scripts that will execute as soon as possible and the list of scripts that will execute in order as soon as possible are empty.
6) Spin the event loop until there is nothing that delays the load event in the Document.
7) Queue a task to run the following substeps:
Set the current document readiness to "complete".
Load event: If the Document object's browsing context is non-null, then fire an event named load
at the Document object's relevant global object, with legacy target override flag set.
Since queued tasks are guaranteed to run in the order they were queued, the order of these two events is guaranteed.
In fact, the DOMContentedLoaded
event will already have been processed by step 5 and 6 ("spin the event loop") before load
is added to the queue.