element.removeEvents fails to remove delegated events on focus #2407

DimitarChristoff opened this Issue Aug 14, 2012 · 5 comments


None yet

4 participants

MooTools member

this is breaking now, used to work in 1.3.2

var form = document.getElement('form');

// store focus for trying
var boundFocus = function() {
    // unbind it. both fail.
    form.removeEvent('focus:relay(input,select,textarea)', boundFocus);

form.addEvent('focus:relay(input,select,textarea)', boundFocus);

on a simple dom:

    <input />

focus once. blur. focus again. expected: no console output.


and on 1.3.2 via -more - as expected. http://jsfiddle.net/qSCvc/4/

MooTools member

seems related to focus. for example, this works on keypress -> http://jsfiddle.net/qSCvc/5/ so it may be down to event types...


It seems to be a browser specific issue.

I'm getting the same (unexpected) result in Windows IE9 – but works as expected on IE8 and Chrome on the Mac.

MooTools member

in my chrome on osx, it fails to remove the focus:relay event - though I originally discovered it on Firefox nightly (Aurora).


Sorry you're right – it's an issue on Chrome etc for me too… and yes, it seems to be isolated to focus:relay.


They have forgot to add the capture mod.
Change in mootools Element.Delegation.js on line 178

return removeEvent.call(this, type, delegator);


return removeEvent.call(this, type, delegator, _map.capture);

it seems, it's new in the browser that they handle the capture mods different....

@arian arian closed this in 1b80dd4 Dec 19, 2012
@arian arian added a commit that referenced this issue Dec 19, 2012
@arian arian Fixes #2407 - Merge branch 'fix-2407' edef4ae
@ibolmo ibolmo added a commit to ibolmo/mootools-core that referenced this issue Feb 16, 2014
@simon-at-fugu simon-at-fugu Fixes #2407 - add capture info to removeEvent 0c064bc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment