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: Jacob Rossi <Jacob.Rossi@microsoft.com>
Date: Tue, 9 Aug 2011 17:40:37 +0000
To: Dominic Cooney <dominicc@chromium.org>, Rob Brackett <rbrackett@apple.com>
CC: "schepers@w3.org" <schepers@w3.org>, Jonas Sicking <jonas@sicking.cc>, Cameron McCormack <cam@mcc.id.au>, "Olli@pettay.fi" <Olli@pettay.fi>, "www-dom@w3.org" <www-dom@w3.org>
Message-ID: <D0BC8E77E79D9846B61A2432D1BA4EAE0340FAAD@TK5EX14MBXC287.redmond.corp.microsoft.com>
Thanks for pointing out the typo. I’ve corrected this.

-Jacob

From: dominicc@google.com [mailto:dominicc@google.com] On Behalf Of Dominic Cooney
Sent: Saturday, August 06, 2011 8:15 AM
To: Rob Brackett
Cc: Jacob Rossi; schepers@w3.org; Jonas Sicking; Cameron McCormack; Olli@pettay.fi; www-dom@w3.org
Subject: Re: Functions that Implement the EventListener Interface (DOM Level 3 Events)

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<mailto: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 Tuesday, 9 August 2011 17:41:07 GMT

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