web dev//rendering//DOM

The in-memory representation of the document that the browser builds and that JavaScript can modify. The HTML that arrived is the initial blueprint; the DOM is the building the browser has assembled right now.


The in-memory representation of the document that the browser builds and that JavaScript can modify. The HTML that arrived is the initial blueprint; the DOM is the building the browser has assembled right now.

HTML is what the server delivers initially: raw material. HTML and DOM can start similar and end up very different once JavaScript modifies the page, adds elements, fetches data, removes nodes.

A non-rendering crawler only ever sees the HTML; a rendering crawler and any browser automation see the DOM. Under CSR the difference is the whole page; under SSR it is mostly the interactive parts added by hydration.

Parsing HTML produces a tree of the same shape; the DOM is that tree kept alive and mutable inside a running browser.