whatwg / html

HTML Standard
https://html.spec.whatwg.org/multipage/
Other
8.17k stars 2.69k forks source link

Should document.fonts.add delay Window load events? #10758

Closed Agog-io closed 1 week ago

Agog-io commented 1 week ago

What is the issue with the HTML Standard?

Similar to #5824 , I noticed that using something akin to the following block of code before window load event firing , delays it for the duration of loading font-name.ttf

const font = new FontFace(
    "font-name",
        "url(font-name.ttf)"
);

document.fonts.add(font);

I am building a system that uses JS to load fonts and I would like to know if this is intended (current behavior actually helps my implementation , but I would like to know if I am depending on a bug or not ).

Edit: Tested on Chromium and Firefox Desktop

domenic commented 1 week ago

document.fonts is defined in https://drafts.csswg.org/css-font-loading/#FontFaceSet-interface, so please file this issue on https://github.com/w3c/csswg-drafts/labels/css-font-loading-3 .