A quick introduction to the DOM

HTML documents consist of a tree of elements and text. Each element is denoted in the source by a start tag, such as <body>, and an end tag, such as </body>. Certain start tags and end tags can in certain cases be omitted and are implied by other tags.

HTML user agents, such as web browsers, then parse this markup, turning it into a DOM, or Document Object Model, tree. A DOM tree is an in-memory representation of a document.

DOM trees contain several kinds of nodes, in particular DocumentType, Element, Text, and Comment nodes.

Since DOM trees represent HTML documents when implementations process and present them, the HTML Standard is mostly phrased in terms of DOM trees instead of source markup.