Re: Better event listeners

On Thu, Jan 10, 2013 at 3:35 AM, Jonas Sicking <jonas@sicking.cc> wrote:
> In order for that to work you need to do selector-based filtering of
> event.target, not event.currentTarget.

Yeah, my bad.


> Instead we should make it possible to at the time of registration,
> select whether the listener wants to listen to during the bubbling,
> target or capture phase. And maybe allow multiple phases. We could
> certainly have defaults based on the event type, but I think it should
> be possible to override that default.

Agreed.


> foo.addEventListener("click", object.clickhandler.bind(object));
>
> which is pretty verbose.

We discussed this in depth before when discussing the approach for
callbacks. We decided bind() was exactly the kind of feature that can
be used for this and maybe future editions of JavaScript should make
it easier to use, but that we would not try to work around it.


-- 
http://annevankesteren.nl/

Received on Thursday, 10 January 2013 12:47:37 UTC