W3C home > Mailing lists > Public > www-dom@w3.org > July to September 2011

Re: Functions that Implement the EventListener Interface (DOM Level 3 Events)

From: Dominic Cooney <dominicc@chromium.org>
Date: Sun, 7 Aug 2011 00:15:15 +0900
Message-ID: <CAHnmYQ9x7DrurD+b6qdcfE-ryAPyOW9t7eXZfDtd8uRNx5nrqQ@mail.gmail.com>
To: Rob Brackett <rbrackett@apple.com>
Cc: Jacob Rossi <Jacob.Rossi@microsoft.com>, schepers@w3.org, Jonas Sicking <jonas@sicking.cc>, Cameron McCormack <cam@mcc.id.au>, Olli@pettay.fi, www-dom@w3.org
I believe this new text is incorrect at the highlighted point:

The listener parameter must be either an object that implements
the EventListener interface or a function. If listener is a function then it
must be used as the callback for the event; otherwise,
if listener implements ***EventTarget***, then its handleEvent method must
be used as the callback. If listener is a function that also has
a handleEvent method, the function itself must be used as the callback and
not its handleEvent method.

It should read:

The listener parameter must be either an object that implements
the EventListener interface or a function. If listener is a function then it
must be used as the callback for the event; otherwise,
if listener implements EventListener, then its handleEvent method must be
used as the callback. If listener is a function that also has
a handleEvent method, the function itself must be used as the callback and
not its handleEvent method.

Sincerely,

Dominic

On Thu, Jun 30, 2011 at 11:30 AM, Rob Brackett <rbrackett@apple.com> wrote:

>
> On Jun 24, 2011, at 10:27 AM, Jacob Rossi wrote:
>
> Hi Rob,
>
> Sorry for a late reply. First, I completely agree that what's currently in
> the spec is just broken. The second paragraph is the intended spec'd
> behavior--the others need to be removed.
>
>
> Since it doesn't seem like there is much interest in changing the specified
> behavior, this is what I'd like to request as well. I think the following
> wording (or something similar) would be pretty good for the description of
> the "listener" parameter of the EventTarget interface's addEventListener()
> method:
>
> The listener parameter must be either an object that implements
> the EventListener interface or a function. If listener is a function then it
> must be used as the callback for the event; otherwise,
> if listener implements EventTarget, then its handleEvent method must be used
> as the callback. If listener is a function that also has a handleEvent
> method, the function itself must be used as the callback and not its
> handleEvent method.
>
>
> This is basically the same as the current second paragraph from the current
> spec. I've added one sentence at the end to make the use case in question as
> clear as possible since it does not seem like D3 Events is using attributes
> in its IDL (*should* attributes like [Callback] be used in D3 Events?).
>
> Thanks!
>
> -Rob
>
Received on Saturday, 6 August 2011 20:30:13 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:14:08 GMT