DOM Specification

What is the DOM?

The Document Object Model (DOM) is an Application Programming Interface (API) which allows programs and scripts to access and manipulate documents. In the context of web development, the DOM represents the structure of an HTML document within the web browser's memory. Manipulating the DOM allows developers to access and update the content, styling, and structure of web documents without altering the source code.

DOM Specifications

The Web Hypertext Application Technology Working Group (WHATWG)—a community of individuals founded by members of Apple, Mozilla, and Opera—sets the specifications for the DOM in collaboration with the W3C. WHATWG maintains the Living Standards for DOM, while the W3C provides input and endorses their standards. The DOM is designed to be platform-neutral and language-neutral, meaning any programming language may access and modify it, although JavaScript is primarily used.

DOM Implementation

The DOM is implemented in browsers in a process called parsing, in which the browser reads the HTML and builds a DOM tree from it. Web pages represented in the DOM are laid out as a node tree, with each branch ending in a node containing objects (in the case of HTML, these objects represent the HTML elements). Objects containing other objects are called parents, while the objects they contain are called children. When two or more objects reside in the same parent object, they are referred to siblings. Once the tree has been built, it is saved in the browser's memory as the "document" object, which then becomes accessible by JavaScript and browser's developer tools.

Summary

The Document Object Model is a useful API that allows many programming languages and applications to access the structure of a document and manipulate its content, layout, and styling. It is because of the DOM that JavaScript can change how a web page looks without modifying the underlying source code. The standards set in place for the DOM ensures it is kept accessible and up to date with newest versions of major browsers as well as usable by a variety of programming languages.

Sources: