Commit f68905a
committed
feat(ie-html): implement core HTML tree builder state machine #57
WHATWG tree construction with basic insertion modes:
- TreeBuilder struct: open elements stack, head/form pointers,
insertion mode tracking, pending text accumulation
- ParseResult: document + errors + style_elements + link_stylesheets
- Insertion modes: Initial, BeforeHtml, BeforeHead, InHead,
InHeadNoscript, AfterHead, InBody, Text, AfterBody, AfterAfterBody
- InBody handles: block elements (div, p, ul, etc.), headings (h1-h6
with nesting fix), void elements (br, hr, img, input), inline
elements (basic push/pop), form handling
- Core operations: insert_element with attributes, insert_character
with text node coalescing, insert_comment, generate_implied_end_tags,
scope checking (regular + button scope), close_p_element
- Tokenizer integration: state switching for script (ScriptData),
style/noframes (RawText), title/textarea (RcData)
- Text mode: captures style content → style_elements, link hrefs →
link_stylesheets
- Implicit element creation: html, head, body auto-inserted
- 12 unit tests covering document structure, implicit elements,
void elements, style/link extraction, nesting, comments, doctype1 parent 3959213 commit f68905a
3 files changed
Lines changed: 1385 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
13 | | - | |
| 14 | + | |
0 commit comments