mootools/mootools-core — Issue #2186: Function.bind and Events
Author: MArcJ
Created: 2011-12-22 04:52:49+00:00
State: open

I'm not a good explainer, therefore here's a snippet: http://jsfiddle.net/YSn6Y/2/.

After adding a binded function to an event, I'm unable to remove it. The only workaround is to save the binded function as reference and use this reference to add/remove the function from the event.

```javascript

//Does work:
var foo = this.myFunc.bind();
this.addEvent('click', foo);
this.removeEvent('click', foo);

//Does not work:
this.addEvent('click', this.myFunc.bind());
this.removeEvent('click', this.myFunc.bind());

```

So, my questions is: Is this a bug or is this normal desired behavior ?