[css-font-loading] handling when the FontFaceSet becomes empty

The spec currently says to set a FontFaceSet's status attribute to 
"loaded", dispatch loadingdone & loadingerror events, and resolve its 
[[ReadyPromise]] if "there are ever no pending font loads and either of 
font face set’s [[LoadedFonts]] or [[FailedFonts]] slots are not empty".

First, I think this should be reworded to talk about running these steps 
when you transition from "not(there are no pending font loads)" to 
"there are no pending font loads", otherwise it reads like a FontFaceSet 
containing only loaded/error FontFaces should constantly be running 
these steps.

Second, what's the reasoning behind not running these steps when there 
are no FontFace objects in the FontFaceSet at all?  I think it's 
consistent with the FontFaceSet's status initially being "loaded" to 
change it to "loaded", dispatch a loadingdone event and resolve the 
promise in this example:

   assert(document.fonts.status == "loaded");
   var face = new FontFace("test", "url(x)");
   face.load();
   document.fonts.add(face);
   assert(document.fonts.status == "loading");
   document.fonts.clear();

   // Here I would expect document.fonts.status to be "loaded",
   // a loadeddone event to be dispatched with an empty list of
   // FontFaces, and for document.fonts.ready to have been replaced.

Received on Saturday, 5 July 2014 08:19:15 UTC