Sign in
Log inSign up

How does the browser know when to repaint the UI?

Jonathan's photo
Jonathan
·Oct 13, 2016

For example, if I update innerHTML of a div after an AJAX call, how does the browser know that it's time to refresh/repaint the UI?

document.getElementById('someid').innerHTML = response.responseJSON.text;

In this case as soon as innerHTML is set, the change is visible on the UI. How exactly does it happen?