DOM

A 1-post collection

removeEventListener and this

Have you ever tried to call removeEventListener on a previously attached element and couldn't remove it? Did you maybe try to pass a function to addEventListener that is bound to another context? The context of the callback that we are passing to addEventListener is the same as the event.currentTarget when is being called. The problem is that when we bind the callback to another object, we can't remove it afterward. Lets see an example: let element = document.createElement('button') »