Deferred scripts will now be executed after stylesheets are loaded


Categories: CSS, HTML, JavaScript

Releases: Firefox 76, Firefox 78 ESR


The WHATWG community has discussed the inconsistent behaviour of <script defer>, that should wait for stylesheets being loaded as per the spec but no browsers other than the legacy version of Microsoft Edge had done it. This problem was causing a flash of unstyled content (FOUC) on various websites particularly in Firefox.

Firefox 76 has solved the issue, and deferred scripts, including modules deferred by default, will be executed after all stylesheets are loaded. Web developers need to expect inconsistent rendering behaviour until the change is implemented by other modern browsers.

How can I test this?

This change can be tested with the compatibilty checker in our Firefox Developer Tools extension. Get it today!