W3C home > Mailing lists > Public > public-script-coord@w3.org > January to March 2013

RE: Fwd: [IndexedDB] Event handlers

From: Travis Leithead <travis.leithead@microsoft.com>
Date: Thu, 24 Jan 2013 17:33:12 +0000
To: Anne van Kesteren <annevk@annevk.nl>, Cameron McCormack <cam@mcc.id.au>
CC: David Bruant <bruant.d@gmail.com>, "public-script-coord@w3.org" <public-script-coord@w3.org>, Ms2ger <ms2ger@gmail.com>
Message-ID: <9768D477C67135458BF978A45BCF9B3853BA5242@TK5EX14MBXW605.wingroup.windeploy.ntdev.microsoft.com>
> -----Original Message-----
> From: annevankesteren@gmail.com [mailto:annevankesteren@gmail.com] On
> On Thu, Jan 24, 2013 at 8:55 AM, Cameron McCormack <cam@mcc.id.au> wrote:
> > It seems a bit like a layering violation for Web IDL to describe events.
> > The "EventHandler" name is already pretty suggestive about the purpose
> of
> > the attribute, IMO. :)
> The main problem at the moment with on/event/ is that you cannot
> actually tell from that whether such events will be dispatched on that
> object and no others. (E.g. DOMContentLoaded is dispatched on objects,
> but has no corresponding on/event/ attribute, events for media
> elements have on/event/ attributes on HTMLElement rather than just
> <video> and <audio>, etc.) Although I suppose that is only true for
> HTMLElement/Document/Window and not true for other classes, such as
> XMLHttpRequest.
> I don't think we've settled on a strategy here yet.
> Maybe IDL is not the right place, but giving a listing of events
> dispatched next to the IDL might be nice for developers trying to
> figure out what the object can do.

Events are funny things. The names are just strings, and you can use that string in combination with a registration method on any object that supports the registration method. The only problem is that you have no idea whether the UA will dispatch an event corresponding to that name on the object you've chosen. The only "pseudo" indicator is the .on/event/ attributes.

I'm not proposing a solution, only to say that this is a fairly complex problem. Take IndexedDB for example, their event propagation model is fairly complex (among objects that are not in a DOM tree relationship). I haven't seen a great way to declaratively express the combination of expected propagation model, target objects, and type-binding for events yet. But if anyone has a good proposal, it would be nice to have somewhere (and it could even land as valid WebIDL syntax--maybe).
Received on Thursday, 24 January 2013 17:34:14 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:14:08 UTC