What Is The DOM?

What Is The DOM
Wikimedia

Date First Published: 29th September 2022

Topic: Web Design & Development

Subtopic: Web Development

Article Type: Computer Terms & Definitions

Difficulty: Advanced

Difficulty Level: 8/10

CONTENTS

Learn more about what the DOM in this article.

Stands for the Document Object Model. The DOM is an API that defines the structure and content of documents on the Web, such as HTML and XML documents as well as the ways that they can be accessed and manipulated. Documents have a logical structure that is like a tree as all the elements are displayed in a hierarchy with each branch ending in an element node under the document root (<html>) and each element node having the text node that contains the text of that element. The DOM elements are represented as nodes and objects in order for programming languages, such as JavaScript to interact with the page by modifying the style, structure, and content of the document.

Since most webpage events are performed by non-HTML code, dynamic webpages always rely on the DOM to display and function properly as HTML documents by themselves are not objects. All HTML attributes are attribute nodes and comments are comment nodes. The tables, headers, titles, paragraphs, images, alt attributes, and other elements of a HTML document are all part of the DOM. Also, the DOM is not a programming language. It is a hierarchical representation of document nodes for both HTML and XML documents.

The W3C standardised the DOM and developed a recommendation in 2004. WHATWG (Web Hypertext Application Working Group) took over the development of the standard and published it as a dynamic document. It originated as a specification to enable JavaScript code to be portable amongst different web browsers. In the past, the DOM had differences between web browsers, but as of now, it is much more standardised and enables easier cross-browser scripting to be performed.

Parts Of The DOM

The DOM is made up of three different parts, including:

  • Core DOM - The standard model for all structured documents.
  • XML DOM - The standard model for XML documents.
  • HTML DOM - The standard model for HTML documents.


Feedback

  • Is there anything that you disagree with on this page?
  • Are there any spelling, grammatical, or punctuation errors on this page?
  • Are there any broken links or design errors on this page?

If so, it is important that you tell me as soon as possible on this page.