DEV Community

Discussion on: Function identity in JavaScript, or how to remove event listeners properly

Collapse
 
orilev profile image
OriLev • Edited

stackoverflow.com/a/21667010/7435195

You can find there insightful explanation regarding a problem you might face when using this

Following that I'd recommend to read the links in the other comments.

Event bubbling is facinating! :)

Collapse
 
smotchkkiss profile image
Emanuel Tannert

Thank you for the comment. I wasn’t aware of the exact behaviour of this in event handlers.

I tend not to use mechanisms like this because they make less explicit what I’m trying to do. Also, they cannot be used with ES6 arrow functions, because they always keep the this binding from their lexical context.

@fgiraldi Kyle Simpson’s third “You Don’t Know JS” book (which can be read on GitHub for free) explains this in a lot of detail: github.com/getify/You-Dont-Know-JS...