DOM (Document Object Model) is a standard maintained by WHATWG, it specifies the data structure for representing structured documents.

The Document Object Model (DOM) is a platform and language-neutral interface that allows programs and scripts to dynamically access and update the content, structure, and style of a document

Main Structure

DOM represents a document as a tree structure the structure consists of node object, elements, attributes and content are represented by nodes

Nodes have properties such as parentNode, childNodes, etc.
Nodes have methods that can be used to manipulate the document such as appendChild(), insertBefore() etc

The HTML specification is an extension to the DOM specification with extensions for web documents.

  • head, title, body are all child nodes to Document
  • innerHTML and outerHTML are additional APIs for the representation of HTML in DOM

DOM in JS

JavaScript can be used to traverse and manipulate the dom.