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

Re: addEventListener naming

From: Jonas Sicking <jonas@sicking.cc>
Date: Sat, 12 Sep 2009 14:21:08 -0700
Message-ID: <63df84f0909121421m120adee5h27fd1776cb9aa549@mail.gmail.com>
To: Doug Schepers <schepers@w3.org>
Cc: "www-dom@w3.org" <www-dom@w3.org>, Alex Russell <slightlyoff@google.com>
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
Received on Saturday, 12 September 2009 21:22:09 GMT

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