The DOM (Document Object Model)

By: Dusty Arlia
Published on February 15, 2013
Last Updated on Wednesday, July 15, 2015 at 7:04 PM
Total Updates: 5

The DOM (Document Object Model) is a specification provided by the W3C. It provides a way to access elements in an HTML document. The DOM creates a hierarchical tree structure to represent the HTML document and through this structure (API), you can manipulate the DOM using a scripting language (the default scripting language is JavaScript). A more technical way of wording this is that the DOM is an API for HTML and XHTML documents. It provides a structural representation of a webpage, which allows you to change its contents using a scripting language like JavaScript.

Every HTML document has a DOM. The DOM is the convention for representing and interacting with the objects on a webpage. This hierarchical structure is also referred to as the DOM tree. The DOM is formed with the HTML tags which can be further modified using the functions of scripting languages.

The DOM has gone through different versions of standardization by the W3C. These versions are known as levels:

  • DOM Level 0 (Never officially standardized by the W3C. Known as legacy DOM)
  • DOM Level 1
  • DOM Level 2
  • DOM Level 3
  • DOM Level 4 (currently being developed)

There was a DOM Level 0 referred to as Legacy DOM when browsers first started to detect user generated events. This was the early stages of using onload and hover events. No independent standard was developed for DOM Level 0, but it was partly described in the specification of HTML4.