concept
Layout thrashing — CSS reference
Repeated geometry reads after mutations can cause multiple synchronous layouts in one task. Batch reads before writes when the algorithm permits it. This example uses independent initial widths, so both approaches produce the same outcome; compare the separate engine performance counters rather than assuming a universal speedup.
Formal Syntax & Structure
css syntaxcss
Read all widths, then write all new widths.Working Example
Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>layout-thrashing</title><style>body{margin:8px;font:16px/24px sans-serif;color:black;background:white}#a{box-sizing:border-box}.item{width:100px;height:12px}</style><body><div class="item">A</div><div class="item">B</div><div class="item">C</div></body></html>