Chapter 6The Document Object Model

What is the DOM?

The Document Object Model (DOM) is an API for manipulating HTML and XML documents. It’s a tree hierarchy of objects representing a document, and facilitates scripting by exposing methods and properties. Though the DOM is quite powerful today, and large parts of its specification are well-supported across all major browsers, this wasn’t always the case.

At first there was little uniformity, let alone a specification. Back in the bad old days of the Browser Wars, when Netscape and Microsoft were vying for supremacy over the Web, one-upmanship was the name of the game. This lead to conflicting implementations, with each manufacturer introducing non-standard features into its own product. As developers ...

Get Jump Start JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.