- From: Sam Atkins via GitHub <noreply@w3.org>
- Date: Fri, 20 Feb 2026 12:10:47 +0000
- To: public-css-archive@w3.org
AtkinsSJ has just created a new issue for https://github.com/w3c/csswg-drafts:
== [css-font-loading-3] FontFaceSet.ready promise isn't resolved if no FontFaces are added ==
In this example, according to the spec, `document.fonts.ready` is never fulfilled and the message is not logged:
```html
<script>
document.fonts.ready.then(() => {
console.log("Hello world");
});
</script>
```
The [`[[ReadyPromise]]`](https://drafts.csswg.org/css-font-loading/#dom-fontfaceset-readypromise-slot) is only resolved inside ["switch the FontFaceSet to loaded"](https://drafts.csswg.org/css-font-loading/#switch-the-fontfaceset-to-loaded). This is called from a few different places, most being in response to some JS API being called, which are not relevant to this case. The one other time is this:
> Whenever a [FontFaceSet](https://drafts.csswg.org/css-font-loading/#fontfaceset) goes from [pending on the environment](https://drafts.csswg.org/css-font-loading/#fontfaceset-pending-on-the-environment) to not pending on the environment, the user agent must run the following steps:
> 1. If the [FontFaceSet](https://drafts.csswg.org/css-font-loading/#fontfaceset) is [stuck on the environment](https://drafts.csswg.org/css-font-loading/#fontfaceset-stuck-on-the-environment) and its [[[LoadingFonts]]](https://drafts.csswg.org/css-font-loading/#dom-fontfaceset-loadingfonts-slot) list is empty, [switch the FontFaceSet to loaded](https://drafts.csswg.org/css-font-loading/#switch-the-fontfaceset-to-loaded).
> 2. If the [FontFaceSet](https://drafts.csswg.org/css-font-loading/#fontfaceset) is [stuck on the environment](https://drafts.csswg.org/css-font-loading/#fontfaceset-stuck-on-the-environment), unmark it as such.
However, if the `FontFaceSet` has no `FontFaces`, then its "stuck on the environment" flag is never set, and so we never call "switch the FontFaceSet to loaded".
As an ad-hoc fix, in Ladybird's implementation I've changed the condition in step 1 to be, "If the FontFaceSet is empty, or (original conditions):". This seems to resolve all the issues I was having, but doesn't feel particularly elegant. If we treat a newly created empty FontFaceSet as being in the "loading" state, then we could check that too.
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/13538 using your GitHub account
--
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Friday, 20 February 2026 12:10:47 UTC