scripted steps · no trace
01. How the browser works / Lesson 3 of 4 · beginner · 10 min · 11 steps

Parse, style, layout, paint, composite

Why moving a drawer with left stutters and transform does not.

1-min Short
DOMfrom the HTMLhtmlheadlinkscriptbodyh1pRENDER TREEwhat will be drawnbodyh1pCSSOMfrom style.cssbodyh1HTMLtokens, in orderPARSERdoneSCREENpaintedSTYLELAYOUTPAINTCOMPOSITE

An agent built a filters drawer that slides across an orders page. On a mid-range phone, the slide stutters.

IN THIS LESSONStep 1 of 11 · Symptom0:00 / 2:02

Transcript

follows the lesson · 0 of 11 steps

Parse, style, layout, paint, composite: the whole lesson in words

The filters drawer slides smoothly on a laptop but stutters on a mid-range phone.

The one-page cheatsheet for this lesson →

Sources

orders.html · agent-writtenhtml
<!doctype html>
<html><head><meta charset="utf-8"><title>Orders</title>
<style>
#drawer { position: absolute; top: 0; left: 0; width: 280px;
height: 100vh; background: #2f4fd8; }
ul { margin-left: 320px; }
</style></head><body>
<div id="drawer">Filters</div>
<ul><!-- 300 orders --></ul>
<script>
// Slide the filters drawer across the page.
const drawer = document.getElementById('drawer');
let start;
function frame(t) {
start ??= t;
const x = ((t - start) / 4) % 300;
drawer.style.left = x + 'px';
if (t - start < 2000) requestAnimationFrame(frame);
}
requestAnimationFrame(frame);
</script>
</body></html>
CHEATSHEET

Opens after you lock in your predictions. It states the answers.