DOM Getting started with DOM Getting started


The DOM (Document Object Model) is the programming interface for HTML and XML documents, it defines the logical structure of documents and the way a document is accessed and manipulated.

The main implementers of the DOM API are web browsers. Specifications are standardized by the W3C and the WHATWG groups, and the object model specifies the logical model for the programming interface.

The representation of DOM structure resembles a tree-like view, where each node is an object representing a part of the markup, depending on the type each element also inherits specific and shared functionalities.

The name "Document Object Model" was chosen because it is an "object model" in the traditional object oriented design sense: documents are modeled using objects, and the model encompasses not only the structure of a document, but also the behavior of a document and the objects of which it is composed. In other words, taking the example HTML diagram, the nodes do not represent a data structure, they represent objects, which have functions and identity. As an object model, the Document Object Model identifies:

  • the interfaces and objects used to represent and manipulate a document
  • semantics of these interfaces and objects - including both behavior and attributes
  • the relationships and collaborations among these interfaces and objects