Re: addEventListener naming

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 UTC