I need to fire a script as soon as the page content (the whole HTML element) has been received, but it doesn't have to be rendered yet.
I assume that just having a simple <script>
tag that executes some code at the very top of my page should do the trick?
To formulate the question differently: does DOM ready mean that all elements and resources have been pulled and rendered?
DOM ready means that all the HTML has been received and parsed by the browser into the DOM tree which can now be manipulated.
It occurs before the page has been fully rendered (as external resources may have not yet fully downloaded - including images, CSS, JavaScript and any other linked resources).
The actual event is called DOMContentLoaded
.