Mission 03 / Browser foundations
Browser to DOM
Follow the browser from HTML source to the live document JavaScript can read and change.
Easy50 XPParsingDOMdefer
The flow
HTML becomes a live document
- The browser parses HTML and builds the DOM tree.
- It also processes CSS and calculates the styles and layout.
- JavaScript can find DOM elements and respond to events.
- The browser redraws affected parts when the DOM or styles change.
<script src="script.js" defer></script>
defer downloads the script while HTML is parsed and runs it after the document has been parsed, in document order.
Checkpoint