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

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