Skip to content

removeEvent unload #2296

Closed
steei opened this Issue Feb 16, 2012 · 0 comments

2 participants

@steei
steei commented Feb 16, 2012

Taken & modified from the mootools docs:

var destroy = function(){ alert('Boom: ' + this.id); } // this refers to the Element.
$(document.window).addEvent('unload', destroy);

//later...
$(document.window).removeEvent('unload', destroy);

The event won't be removed. (works fine with 'beforeunload')
Could this be related to the following code snippet in Source/Element/Element.js ?

    if (type == 'unload'){
        var old = fn, self = this;
        fn = function(){ 
            self.removeListener('unload', fn);
            old();
        };

...

@arian arian closed this in 3b0388b Sep 2, 2012
@arian arian added a commit to arian/mootools-core that referenced this issue Sep 5, 2012
@arian arian Better fix for #2296 and #2423 - doesn't wrap onunload functions in a…
…ddListener anymore.
d54312c
@kentaromiura kentaromiura added a commit to kentaromiura/mootools-core that referenced this issue Oct 25, 2012
@arian arian Better fix for #2296 and #2423 - doesn't wrap onunload functions in a…
…ddListener anymore.
f3ce01b
@arian arian added a commit to ibolmo/mootools-core that referenced this issue Feb 16, 2014
@arian arian Better fix for #2296 and #2423 - doesn't wrap onunload functions in a…
…ddListener anymore.
4781d33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.