I have a library that build UI using Javascript, and because of the dynamic content involved I sometimes want to put content out to the browser, examine how the layout was c
Yes, you can!!
Most browsers optimize the reflow process by queuing changes and performing them in batches. Flushing the render tree changes requires you to retrieve some layout information ( offset calculations, getComputedStyle(), and scroll values ).
var el = document.getElementById("my-element");
var top = el.offsetTop;
The above code will force the browser to execute changes in rendering queue in order to return the correct values.
Simple!!