This story is unavailable.

At point 7 of this list, you’ll see that event.currentTarget, which is always the node you attached the listener to, should be used as “this” value.

However, and thankfully, the EventListener allows user objects, and these just need to implement a handleEvent method to become the “this” value of such callback.

I know developers working on Web standards that were unaware themselves about this pattern, and instead of promoting it once realized how much potentials it has, they started convincing everyone else new APIs shouldn’t have such mechanism which is nothing different than a WeakMap-like relationship between a generic DOM node and a generic object.

Me, as 17+ years Web (and other things) Developer, alwasy preferred chose 100% of what the platform offers, and this is one of those underestimated pearl nobody knows but everyone would love.

Unfortunately, you have books, libraries, frameworks, created without knowing how easy it was to have the context in listeners, same people that never used currentTarget but just target, same people binding gazillion references for no reason.

But this is another story, a story I am trying to be far away from ;-)

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.