Deferred scripts will now be executed after stylesheets are loaded

Published:

Categories: CSS, HTML, JavaScript

Releases: Firefox 76

Description

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.

References