Document Object Model

What is DOM?
  • The Document Object Model (DOM) is a Application Programming Interface (API) for HTML and XML documents.
  • With the DOM, programmers can create and build documents, navigate their structure, add, modify and delete elements and content.
  • The DOM is an object-oriented representation of the web page, which can be modified with a language like JS.
  • The DOM represents a document with a logical tree.
  • According to DOM, every HTML element is an object. Nested elements are called the children of the enclosing one. 
  • All operations on the DOM start with the document object from which we can access every node.
  • It can be used with any programming language.
  • One important property of the DOM structure model is structural isomorphism.
The Levels of DOM
  1. Level 0: Supports an interface DOM and provides a low-level set of interfaces. It is a shorthand version of what existed before the standardization process.
  2. Level 1: Includes the navigation of the DOM documents and allows content manipulation
  3. Level 2: Supports namespace, filtered views, and events
  4. Level 3: It has many specifications - Core, Load and Save, XPath, Views and Formatting, Requirements, and Validation.
Categories of DOM
  • DOM Core - It specifies a generic model for viewing and manipulating a marked-up document as a tree structure.
  • DOM Html - It specifies an extension of the Core DOM for use with HTML. It has capabilities for manipulating all of the HTML element objects.
  • DOM CSS - It specifies the interfaces necessary to manipulate CSS rules programmatically.
  • DOM Events - It adds event handling to the DOM.
  • DOM XML - It specifies an extension to the Core DOM for use with XML.


Comments