liveBook · Manning

Document Object Model

As explained in Web Component Development with Modern Libraries and Tooling

The Document Object Model is a tree-structured representation of an HTML or XML document and its nodes.

The Document Object Model (DOM) represents an HTML or XML document as a tree of objects. JavaScript can access and modify those objects to change what the browser displays. section 1.2 section 3.1

The DOM tree contains different kinds of nodes, including:

Custom elements are not self-closing

Built-in elements such as <img> may be written without an explicit closing tag. A custom element such as <hello-world name="Mark"></hello-world> requires both an opening and closing tag, even when it has no content. section 3.1

Web components use DOM concepts to define reusable elements. Their structure, styles, and behavior can also be encapsulated in a shadow DOM, reducing unintended interaction with the rest of the page. section 1.2

How Web Component Development with Modern Libraries and Tooling covers it

How deep it goes
Defines the DOM as a tree of Node objects and identifies elements, attributes, text, and comments without detailing traversal or mutation APIs.
Examples
Uses img syntax and a hello-world custom element to contrast optional and required closing tags.
What you can do after
Evaluate document structure by recognizing its tree of nodes and the markup rules for custom elements.
How it connects
Connects the DOM with web components, custom elements, HTMLElement, and shadow DOM.

Also explained in

Compare how 12 books explain Document Object Model →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Web Component Development with Modern Libraries and Tooling. The section links point to the parts of the book it draws on.