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

Re: addEventListener naming

From: Olli Pettay <Olli.Pettay@helsinki.fi>
Date: Sun, 13 Sep 2009 14:59:31 +0300
Message-ID: <4AACDEA3.4010100@helsinki.fi>
To: Jonas Sicking <jonas@sicking.cc>
CC: Doug Schepers <schepers@w3.org>, "www-dom@w3.org" <www-dom@w3.org>, Alex Russell <slightlyoff@google.com>


Jonas Sicking wrote:
> On Sat, Sep 12, 2009 at 1:19 PM, Doug Schepers <schepers@w3.org> wrote:
>> Hi, Alex-
>>
>> I've tentatively added the 'listen()' and 'unlisten()' methods as syntactic
>> sugar shorthands for 'addEventListener()' and 'removeEventListener()'.
>>  Obviously, this assumes that the implementers have no objections, and are
>> willing to implement these methods.
> 
> For what it's worth, I would rather not implement these new methods in
> Firefox, for the following reasons:
> 
> 1. As far as I can tell it has not been shown that the developer
> community at large sees the long name as a significant problem.
> 2. If the long name is a significant problem, then it can easily be
> worked around in JS by using prototypes. As far as I know no library
> does this, further indicating that this isn't something that
> developers find to be a bug burden. (In fact, if we should 'rename'
> any method, it would be to rename 'document.getElementById' to '$').
> 3. There's a better suggestion in this thread for how to get rid of
> the extra argument; simply mark it [optional].
> 4. More methods for the developer community to learn. While learning
> both isn't needed to write code, it is needed to read other peoples
> code. Ability to read and understand other peoples code is a major
> strength of the web platform.
> 
> / Jonas
> 
> 

I agree with Jonas. I wouldn't want to see listen() and unlisten() added 
to the spec.

-Olli
Received on Sunday, 13 September 2009 12:00:00 GMT

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