Try running the following code in window.onLoad
:
var n = 0;
var N = 75000;
while (n < N)
{
span = document.createElement("span");
span.innerHTML = "0";
document.body.appendChild(span);
n++;
}
console.log("Finished.");
You should find that "Finished" appears in your console several seconds before the span tags appear in your browser. If not, try increasing N
by a few orders of magnitude.
How can I make DOM changes, and detect the moment at which not only the changes are complete, but are rendered on-screen?
I tried a MutationObserver, but it also gets notified several seconds before the changes appear onscreen. You can see that in this fiddle.