It's written everywhere that reading element.offsetWidth
causes a recalculation (or even a reflow?) of the element's dimensions.
However, I'm struggling with making this effect visible.
In chrome I would expect I would be able to make it visible with 3 simple steps:
$0.offsetWidth
Now if I go to the timeline tab I would assume to see a reflow drawn. However, I see nothing. So I must have gotten something wrong.
After some more research, I think I can answer my own question. It's not that reading offsetWidth
directly causes a reflow. It's more that it causes the browser to immediately perform all actions that are stacked in the rendering queue. That in turn can mean multiple reflows if you organize your reading and writing to the DOM in the wrong order.