Chapter 13. The Document Object Model
When you open a web page in your browser, the browser retrieves the page’s HTML text and parses it, much like the way our parser from Chapter 11 parsed programs. The browser builds up a model of the document’s structure and then uses this model to draw the page on the screen.
You can imagine an HTML document as a nested set of boxes. Tags such as
</body> enclose other tags, which in turn contain other tags or text. ...