Web Content & Formats

What is the DOM?

The Document Object Model, a tree of objects that represents an HTML document in memory and lets JavaScript manipulate it.

When a browser parses HTML, it builds a tree: document at the root, then html, head, body, and every nested element as nodes. That tree is the DOM. JavaScript reads and modifies it through document.querySelector, element.appendChild, element.classList, and the rest of the DOM API.

For scrapers, "the DOM" matters because there are two versions of every page: the static HTML the server sent, and the live DOM after JavaScript has run. A scraper that fetches HTML over plain HTTP gets the first; a headless browser gets the second. Many sites only put real content in the second.

For React, Vue, Svelte, and friends, the DOM is the eventual target, they maintain a virtual DOM (a JS-side mirror) and reconcile it to the real DOM when state changes. Most modern UI bugs trace to that boundary, where framework state and the actual DOM disagree.

How Brand.dev uses dom

Endpoints in the Brand.dev API where this concept comes up directly.

FAQ

DOM vs HTML?

HTML is the source markup. The DOM is the in-memory tree the browser builds from that markup, plus everything JS does to it after.

What's the virtual DOM?

A JavaScript-side representation of the DOM that frameworks like React diff against to figure out the minimum real-DOM changes needed. It's an optimization, not a different document.

Is the DOM standardized?

Yes, by WHATWG. Modern browsers all implement DOM Level 4 closely enough that cross-browser scripts work without if (browser) branches.

Related terms

Ship an agent that actually knows things.

Free tier, 10-minute integration, and the same API powering agents at Mintlify, daily.dev, and Propane. No credit card to start.