HTML is the recipe you write. The DOM is the dish the browser actually serves β
a live family tree that JavaScript searches and edits. They are not the same thing.
1 Β· What you wrote (the recipe)
What the student sees
2 Β· What the browser built (the dish)
0elements
0text nodes
0generations deep
document.querySelectorAll()
π¨ Repaint β deewar ka rang badlo
colour, background, shadow. Nothing moves, the browser just re-colours pixels.
StyleLayoutPaintComposite
ποΈ Reflow β furniture khiskao
width, height, margin, font-size, adding elements. Everything around it gets re-measured.
StyleLayoutPaintComposite
πͺ Composite β glass pe sticker khiskao
transform, opacity. The GPU slides an already-painted layer. No re-measure, no repaint.
StyleLayoutPaintComposite
π First turn on paint flashing: Cmd+Shift+P β type paint flashing β Enter.
Green flash = the browser had to repaint that area.
Same zoom effect, two ways:
What you did
Style + layout work (ms)
Until the next frame (ms)
2-second zoom animation
π¨ Text colour (repaint)
β
β
β
ποΈ Text size (reflow)
β
β
β
πͺ Transform (composite)
β
β
β
Every button changes one property on the same box that holds all the students, so the
comparison is fair. Numbers are measured live on your laptop and will differ from your neighbour's β the
order is the lesson. "Until the next frame" includes waiting for the screen's next refresh.