W3C home > Mailing lists > Public > www-style@w3.org > December 2014

Re: [css-font-loading] FontFaceSet.ready value and uniqueness

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Thu, 11 Dec 2014 16:07:53 -0800
Message-ID: <CAAWBYDBzjdkzRw9-ASC2ce8PSXNF9DjaFZPcLFSrHfs4r=KKzg@mail.gmail.com>
To: Bear Travis <betravis@adobe.com>
Cc: "www-style@w3.org" <www-style@w3.org>
On Thu, Dec 11, 2014 at 1:52 PM, Bear Travis <betravis@adobe.com> wrote:
> I have some (hopefully) simple questions about the ready attribute on
> FontFaceSet.
> 1. First, does the attribute change value after it has been fulfilled, but
> then new fonts are added and begin loading? Basically, is there a promise
> fulfillment for each loadingdone event. For example:
> document.fonts.ready.then(function() {
>      // add new font face declarations and style content to use them
>      document.fonts.ready.then(function() {
>           console.log("all fonts loaded");
>      });
> });

Yes, the precise behavior is defined in
<http://dev.w3.org/csswg/css-font-loading/#FontFaceSet-events>

> 2. Is there a requirement that the ready attribute be the same across all
> calls made before it fulfills? Eg:
> Must document.fonts.ready === document.fonts.ready;
> Or could the ready attribute return a separate promise on every read,
> provided that each is fulfilled at the appropriate time?

There's an internal slot that holds a promise, which is replaced only
at specified times.  See the link above for more details.

~TJ
Received on Friday, 12 December 2014 00:08:40 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:49 UTC