Summary
The Document Object Model (DOM) is an API defined by the W3C to represent and interact with any HTML or XML document.
In Depth
The DOM is a model of an {{Glossary("HTML")}} or {{Glossary("XML")}} document that is loaded in a web browser. It represents a document as a tree of nodes, where each node represents a portion of the document, such as an {{Glossary("element")}}, a portion of text or a comment.
The DOM is one of the most used {{Glossary("API")}}s on the web because it allows code running in a web browser to access and interact with every node in the document. Nodes can be created, moved and changed. Event listeners can be added to nodes. Once a given event occurs all of its event listeners are triggered.
The early versions of the DOM were not specified and came from the first {{Glossary("Browser","browsers")}} implementing {{Glossary("JavaScript")}}. This legacy DOM is sometime refered as DOM 0. Today, the DOM specification is lead by the {{Glossary("W3C")}} and the DOM Working Group is currently working on the fourth version of the DOM specification.