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

Re: Better event listeners

From: Glenn Maynard <glenn@zewt.org>
Date: Tue, 12 Feb 2013 09:01:45 -0600
Message-ID: <CABirCh8UhoH1De=kPmP97USjAK+RB-k37WPHbk-DYwq98ETu8Q@mail.gmail.com>
To: Anne van Kesteren <annevk@annevk.nl>
Cc: www-dom@w3.org
On Tue, Feb 12, 2013 at 8:33 AM, Anne van Kesteren <annevk@annevk.nl> wrote:

> On Tue, Feb 12, 2013 at 2:23 PM, Glenn Maynard <glenn@zewt.org> wrote:
> > It doesn't work completely differently.  It works exactly the same.
> > addEventListener("click", func, true) would be exactly equivalent to
> > addEventListener("click", func, {capture: true}).
>
> Yes, but it would also return an object (for which it's not at all
> clear that's web compatible). And I think if the preferred API is
> going to support event delegation we should also by default ignore
> bubbles.
>

No, addEventListener would always return the object, not just when it takes
an object.  That's just adding an orthogonal feature to the method.
(Whether there's code out there somehow depending on addEventListener's
lack of return value is a separate question; I don't know, of course.)

Ignoring bubbles by default makes me a little nervous, since it's a subtle
difference between very similar APIs which people less experienced with DOM
events won't necessarily understand.  Either way, though, having a
different default doesn't seem like a good reason to have a completely
separate API.

-- 
Glenn Maynard
Received on Tuesday, 12 February 2013 15:02:16 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 12 February 2013 15:02:19 GMT