What’s the DOM?

Print anything with Printful



The document object model (DOM) is a hierarchical representation of objects and properties in a web document that can be recognized by a browser. DOM scripting involves coding small programs to add functionality to web pages. Programmers must consider browser compatibility when working with DOM.

The document object model (DOM) is a visual representation of a hierarchical model, or map, of all the objects and properties contained in a web document and that can be recognized by a web browser. This browser object model specifies also the various methods or actions available to a programmer that can be performed on or with objects. The document object model is a representation of the programming or, more precisely, the scripting capabilities. While major browsers support a generic DOM, scripts that work in one browser may not work in another. However, programmers can safely work with objects, properties, and methods according to a basic DOM common to all major Internet browsers.

Web documents appear to be just a single unit within a browser window, but are actually made up of a variety of objects. They can and often contain many properties and behave in different ways due to the variety of methods a programmer can apply to document objects. For example, images may appear in a document and are considered objects within the document, which is itself an object.

Links are also objects on which programmers can use methods or perform actions, such as changing the color of links when you hover over them or viewing or changing an image. DOM scripting involves coding or writing small computer programs known as scripts embedded in web documents. These scripts add functionality to web pages, including but not limited to form validation, virtual calculators, pop-up messages, simple games, quizzes, and even animations.

Programmers code within the capabilities of the document object model they work with, unless they choose to code very conservatively using a generic DOM to avoid the possibility of browser compatibility issues. The document object model is important for programmers who write so-called client-side scripts in web development. Web documents are stored on a web server that delivers pages to the requesting client computer and presents them visually to the website visitor via a browser. Scripts embedded in web pages stored on the web server must be executed on the client computer based on the document object model of that client computer’s browser.




Protect your devices with Threat Protection by NordVPN


Skip to content