Skip to content

[font-loading] document.fonts.ready promise resolution time does not match implementations #1082

Open
@foolip

Description

@foolip

https://drafts.csswg.org/css-font-loading/#dom-fontfaceset-readypromise-slot
https://drafts.csswg.org/css-font-loading/#switch-the-fontfaceset-to-loaded
https://drafts.csswg.org/css-font-loading/#fontfaceset-pending-on-the-environment

Per these definitions, the initial document.fonts.ready promise cannot resolve until "pending on the environment" is false. Making some assumptions about #1081 to clarify, this means that the promise should never resolve before the DOMContentLoaded event is fired.

However, as tested in Chrome, Firefox and Safari, the promise can resolve before anything else interesting happens: https://software.hixie.ch/utilities/js/live-dom-viewer/saved/4923

It might not reproduce with this test depending on network conditions, but I took it and appended a megabyte in a comment block and hosted it far away from me, and that made the promise resolve first in all 3 browsers. (Edge does not support the promise yet.)

Implementations do something different than the spec. We should figure out what it is and if that already happens to be interoperable, perhaps change the spec to say that.

EdgeHTML: @atanassov
Chromium: @kojiishi @irori @drott
Gecko: @dbaron @upsuper
WebKit: @litherum @youennf

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions