Re: [css3-fonts] FontLoader event handlers

On Sun, Jan 27, 2013 at 6:01 PM, John Daggett <jdaggett@mozilla.com> wrote:
> 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".

Yes, doing both is more or less best practice now.  onfoo
attributes/properties are easy to use for simple cases, and
addEventListener is necessary for more complex ones.

> 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.

It would be great to look into this in the future, but I think it's
okay to defer it for now.

~TJ

Received on Monday, 28 January 2013 06:48:24 UTC