tree construction
The parsing stage that takes tokens from the tokenizer and assembles them into the DOM tree, tracking which elements are still open.
In more detail
The tree builder keeps a stack of open elements: a start tag pushes a new element as a child of the current one and an end tag pops it. When markup is broken, rules in this stage decide where misplaced elements actually go.
Related terms
- HTML tokenization — The parsing step that splits a stream of characters into meaningful pieces called tokens, such as a start tag, an end tag or a run of text.
- HTML parser — The part of the browser that reads HTML text and builds the DOM tree from it, one token at a time.
- DOM — The tree of objects a browser builds from a web page, which scripts read and change to update what is on screen.
- HTML error recovery — The HTML parser's standard rules for repairing broken markup, such as unclosed tags, instead of refusing to show the page.
Taught in
- HTML Parsing, Tokenization And The Document Object Model (DOM) — Frontend Architecture & Web Platform