Until recently I thought this was essentially equivalent to when the DOM is loaded. Then when using a script that resizes text, depending on container (Fitty), I started seeing a problem where the calculations were wrong. I initially opened an issue for Fitty. I then found that other scripts were doing similar things (with less dramatic results). Popper.js and Swiper were both getting calculations wrong. Resizing the viewport in all cases would trigger a recalculation, fixing the discrepancy. (This seems to be more of an issue in Firefox than other browsers.)
The only way I could get any of these scripts behaving reliably was to run them on
window.onload. This feels a bit heavy handed, and also like it might be fixing the problem by way of an arbitrary delay. There is no need to wait for images to load in any of these cases (either there are none, or the layout isn’t effected by them).
So is there a way to say “run this when the bowser has loaded (and processed / calculated) the CSS”?