[css3-fonts] FontLoader event handlers

During last week's telcon a point was brought up about the event
handler attributes in the FontLoader interface [1]:

> smfr: I'm a little confused
> smfr: why is this on the font loader interface?
> smfr: the modern way is to do addEventListener
> smfr: I'm unsure why you need all the 'on-' attributes on this font interface
> jdaggett: I need to think about that
> smfr: I haven't seen this pop up on modern APIs lately so don't know if it
>          makes sense
> glazou: I agree with Simon
> <Ms2ger> Modern APIs like WebSocket?
>                 http://www.whatwg.org/specs/web-apps/current-work/multipage/network.html#the-websocket-interface
> 
> florian: in isolation John's proposal makes sense but if it's different
>                 from everything on the platform maybe not
> florian: we need a broader debate to discuss
> dino: it should be possible to base this on the XHR interface
> dino: it would be a single call like addEventListener with the event type
> dino: the current proposal is halfway in between of the 2 worlds
> <Ms2ger> XHR: http://xhr.spec.whatwg.org/#xmlhttprequesteventtarget
> <smfr> Ms2ger: i see 'onfoo' is used there, so maybe it's ok here
> <Ms2ger> The majority of new APIs do have onfoo, AFAICT
> <dino> Yeah, I misunderstood this to be *starting* font loads, rather
>           than querying

As I understand it, several people are wondering why the FontLoader
interface includes explicit event handler attributes, rather than
simply defining a set of events to be used with addEventListener (the
current draft defines both) [2]:

  attribute EventHandler onloading;
  attribute EventHandler onloadingdone;
  attribute EventHandler onloadstart;
  attribute EventHandler onload;
  attribute EventHandler onerror;

I think the assertion here is that "modern" interfaces don't include
event handler attributes.  However, based on discussions with others
at Mozilla, I don't think that's really true.  As ms2ger pointed out
on IRC, recent API's *do* include these (e.g. XHR, WebSocket,
FileReader, IndexedDB) and in general they improve "developer
ergonomics".

Another point was brought up about progress events for font loads.  I
think we could put these in but since font loading in many cases
involves multiple load operations, I don't think they are as simple to
define as they would be for things like XHR requests.

Regards,

John Daggett

Received on Monday, 28 January 2013 02:01:47 UTC