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

Re: Add extra argument to addEventListener with the context

From: Bjoern Hoehrmann <derhoermi@gmx.net>
Date: Sat, 16 Jun 2012 02:19:09 +0200
To: Elliott Sprehn <esprehn@gmail.com>
Cc: www-dom@w3.org
Message-ID: <qoint7h2uinck35ijeh66r0a0ihi320rmj@hive.bjoern.hoehrmann.de>
* Elliott Sprehn wrote:
>Adding this extra parameter cuts down on the amount of manual tracking you
>need to do, removes the need to allocate an extra Function object, and
>removes boilerplate code (it's very common to see people use var self =
>this; in projects).

Adding this extra parameter would increase the number of browser bugs
and the amount of feature support differences, and all you get out of
it once it is supported universally and without notable bugs is a bit
of convenience for the few people writing low level code (most people
use libraries to work around differences in feature support and bugs
in implementations, and as it still is, that includes event handling
wrappers). That's not much if you consider the resources for defining,
documenting, implementing, testing, and so on and so forth could also
be used to fix bugs or implement more features that are supported by
many other browsers, reducing the need for people to use libraries.

That aside, if someone was to improve .addEventListener, adding a 4th
positional argument does not strike me as a very good idea; and I do
not see how .addEventListener is special with respect to the pattern
you seek to optimize for.
Björn Höhrmann · mailto:bjoern@hoehrmann.de · http://bjoern.hoehrmann.de
Am Badedeich 7 · Telefon: +49(0)160/4415681 · http://www.bjoernsworld.de
25899 Dagebüll · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/ 
Received on Saturday, 16 June 2012 00:19:37 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:37:00 UTC