The Document Object Model (DOM) originally came about as a standard means for accessing HTML from JavaScript. Initial DOM specifications referred as DOM Level 1 standards were with two main modules, the Core and the HTML modules. These were extended by W3C recommendations in two stages named as Level 2 and Level 3 DOM Specifications. DOM Level 1 identifies properties directly related to tags required in HTML while DOM Level 2 is a language agnostic. This chapter talks about changes/additions in various modules of the specification during Level 2 and Level 3 specification definitions. DOM Level 3 is primarily concerned with namespaces, inheritance, and extension of node names and definitions.

DOM Core module

The DOM Core module defines a set of objects and interfaces for accessing and manipulating document objects. It includes requirements of XML, better error handling and feature detection. 

HTML module

The HTML module describes changes in objects and methods specific to HTML documents and XHTML documents.

Views module

The static or dynamic rendition of the document contribute to the Views module. Interfaces AbstractView and DocumentView were introduced in DOM Level 2.

Style Sheets, CSS, CSS2 module

DOM Level 2 Style sheet interfaces module are base interfaces used to represent any type of style sheet. This module defines following interfaces: StyleSheet, StyleSheetList, MediaList, LinkStyle, and DocumentStyle. Each style sheet has an additional interface called, CSSStyleSheet, CSSRuleList, CSSRule, CSSStyleRule, and CSSMediaRule.   

Events module

The Events module consists of events such as User interface Events, Mouse Events, Mutation Events, or HTML Events.

A more standardised and flexible approach of managing events and subscriptions is consisting of addEventListener, removeEventListener and dispatchEvent methods. These events are generated by user interaction through an external device (mouse, keyboard, etc.), notification of any changes to the structure of a document (mutation events) and to pass contextual information (HTML Events).

Range module

A Range module identifies a range of content in a Document, DocumentFragment or Attr types. The Range interface provides methods for accessing and manipulating the document tree.

Traversal module

The Traversal module is made of TreeWalker, NodeIterator, and NodeFilter interfaces which provide easy-to-use, robust, selective traversal of a document's contents.

XPath module

The XPath DOM level 3 module helps in evaluation of XPath expressions in DOM.

Load and Save module

The Load and Save DOM level 3 module loads the content of a XML document to a DOM document and serializes a DOM document to a XML document.

 

All of the above modules are discussed in further parts of tutorials in detail.

How to check if a DOM module exists 

According to W3C, a DOM implementation must return "true" to the hasFeature(feature, version) method of the DOMImplementation interface to test whether a specific feature for a specific version of the DOM is implemented.

Syntax

var supported = document.implementation.hasFeature('Events', '2.0');

This code, checks for “Events” module support of DOM level 2 standards.

 

›› go to examples ››