DOM implementation techniques
summary
Browsers build a layout/render tree that maps DOM nodes to rectangles, then top‑down layout assigns sizes (tables may need multiple passes), and lazy reflow marks dirty nodes so scripts avoid repeated work. Style matching uses buckets (ID/class/tag/others) to avoid millions of rule checks — Twitter would need ~10 million naive matches. Reading layout properties forces an immediate layout — the CodeMirror case rewrites a loop to compute nodes then add => 3 ms and avoids freezes. GPUs handle layers and 3D transforms for faster drawing; reflow-on-read forces layout.
AI-written summary · about
chapters (11)
- 0:00Intro
- 1:00The browser
- 2:10Render tree
- 3:15Layout tree
- 3:45Layout in
- 5:20Layouts
- 6:20Styling
- 7:15Reflow
- 11:55Drawing
- 14:50Style matching
- 16:15Buckets








