The DOM represents document structure as nodes. The parser opens children on start tags and returns to parents on end tags.
In the demo, each input line adds a node to the tree. DOM changes can make the browser recompute relevant styles and display, so consider structure changes together with visual updates.
When to use
Use this model to reason about element selection, event delegation, and dynamic UI updates.