Add extra argument to addEventListener with the context

Google Closure supports an additional final argument to addEventListener
that's the context the method is called with:

target.addEventListener(event, fn, capture, context)

So you could do

target.addEventListener(event, this.handleClick, false, this);

and later

target.removeEventListener(event, this.handleClick, false, this);

It'd be nice to get native support since it makes adding and removing
listeners easier.

- E

Received on Friday, 15 June 2012 17:21:55 UTC