Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
The beauty of the Document Object Model is that it gives us a consistent way, across all browsers, to gain access to the structure and content of the HTML from code. That’s huge. And we’re going to see how all that works in a sec...
Back to our example; if you follow the recipe for creating a DOM you’ll end up with a structure like the one below. Every DOM has a document object at the top and then a tree complete with branches and leaf nodes for each of the elements in the HTML markup. Let’s take a closer look.