W3C home > Mailing lists > Public > www-dom@w3.org > April to June 2011

Re: [DOMCore] change EventListener to [NoInterfaceObject]?

From: Rob Brackett <rbrackett@apple.com>
Date: Fri, 17 Jun 2011 19:28:38 -0700
Cc: www-dom@w3.org
Message-id: <1DED52A7-9F29-4953-B54B-33DFD90E2170@apple.com>
To: Boris Zbarsky <bzbarsky@MIT.EDU>

On Jun 17, 2011, at 10:04 AM, Boris Zbarsky wrote:

> On 6/17/11 12:09 PM, Anne van Kesteren wrote:
>> On Wed, 15 Jun 2011 13:01:48 +0200, Ms2ger <ms2ger@gmail.com> wrote:
>>> On 06/15/2011 07:14 AM, David Flanagan wrote:
>>>> EventListener is declared to be a [Callback], but unlike the [Callback]
>>>> types in HTML, it does not have the [NoInterfaceObject] attribute. This
>>>> seems to mean that implementations must create a useless EventListener
>>>> property in the global namespace. And by my reading of WebIDL, we're
>>>> also supposed to have EventListener.prototype.handleEvent, even though
>>>> no host object will ever be created that inherits that method.
>>>> 
>>>> Firefox 4 defines an EventListener object, but it has no prototype
>>>> property and doesn't seem to be good for anything.
>>>> 
>>>> Current versions of Chrome and Safari simply do not define
>>>> EventListener. I think this is the way to go.
>>> 
>>> Done.
>>> 
>>> http://dvcs.w3.org/hg/domcore/rev/a48d3dccf595
>> 
>> Can we also make it FunctionOnly in ECMAScript?
> 
> That is, make this not work?
> 
>  node.addEventListener({ handleEvent: function() { /* something */ } },
>                        "eventname", false);
> 
> I'm pretty sure this pattern is used on the web.

Very widely used, and more so over the last nine months or so—after this pattern got some press on ajaxian.com. I've worked on a lot of code that relies on this convention.

-Rob
Received on Saturday, 18 June 2011 02:29:19 GMT

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