W3C home > Mailing lists > Public > www-dom@w3.org > January to March 2013

Re: Better event listeners‏

From: Erik Arvidsson <erik.arvidsson@gmail.com>
Date: Mon, 7 Jan 2013 12:27:31 -0500
Message-ID: <CAL=P+5Kww793hoso_w2SVHNTRSNQmAggR2f3NjehyHUC5QtEjQ@mail.gmail.com>
To: Anne van Kesteren <annevk@annevk.nl>
Cc: François REMY <francois.remy.dev@outlook.com>, DOM WG <www-dom@w3.org>, es-discuss <es-discuss@mozilla.org>
On Mon, Jan 7, 2013 at 12:00 PM, Anne van Kesteren <annevk@annevk.nl> wrote:
> On Mon, Jan 7, 2013 at 5:42 PM, François REMY
> <francois.remy.dev@outlook.com> wrote:
>> However, I've a few issues with your latest proposal:
> There's no proposal yet, we're exploring options.
> Not quite convinced about yours though as I'm pretty sure we want to
> continue minting lowercase event names and overall it seems way
> complex.

For the Dart DOM we wanted to fix the naming conventions of events as
well as fix some inconsistencies (dblclick is the only one that is
abbreviated for example). I'm not convinced it was worth it. It did
lead to issues where the .type of an event name diverged (or had to be
fixed up internally) from the key in the event map.

One good thing that came out of the Dart experiment was the on
property, which like François mentioned allows IDEs to autocomplete
the known event types. Another neat thing was that the on property was
also defined as a Map<string, EventListenerList> so one could do
indexing for custom events. The known events were simple defined as:

  get mouseOver() {
    return this['mouseover'];

so that the following two were equivalent:

  element.on['mouseover'] === element.on.mouseOver

  element.on['my-custom-event'].add((e) => { console.log(e); })


Received on Monday, 7 January 2013 17:28:18 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:20 UTC