Re: [css3-fonts] rethinking font load events

Glenn Adams wrote:

>>>>   // notify completion, even if no fonts load
>>>>   void notifyAfterCompletion();
>>>
>>> The utility of this method seems particularly questionable. What should a UA
>>> do when this is called?
>> 
>> If FontLoader.readyState is "loading", nothing.
>> 
>> If it's "idle", fire an "allcomplete" event anyway.
> 
> Then what is the point? Why have the client code call a method to
> that only translates to firing allcomplete when the client code can
> invoke the same allcomplete handler?

This API is a way of sync'ing with layout changes that might or might not
initiate font loads.  The client code can't call the allcomplete handler until
layout changes are processed.  In most cases the code below would work but
it would be nicer to have this done by the user agent:

  setTimeout(function () { if (document.fontloader.readyState == "idle") doStuff(); }, 100);

Ping me on irc if you want to discuss.

Cheers,

John

Received on Friday, 7 September 2012 03:04:06 UTC