DEV Community

Discussion on: Understanding Reflow and Repaint in the browser

Collapse
 
avivhdr profile image
Aviv Hadar

I was just asked about this issue in a job interview.

Great Article but I am missing an example.
will this action result in a repaint of the entire page:
document.getElementById("demo").innerHTML = "Paragraph changed!";
?

And both repaint and reflow equally expensive?

Collapse
 
wangkangping profile image
wangkangping

Each time you try to update innerHTML, reflow will happen. Since updating innerHTML will cause the change of position of other elements. So that's why reflow happens.

In my view, reflow is more expensive than repaint. If you see how browser works, You will know it.
Here is the link: blog.sessionstack.com/how-javascri...