Open mschipperheyn opened 9 years ago
I resolved this by
,connect: function(node, evtType, context, callback){
//TODO: use event listeners instead
var self = this;
function handler(evt){
evt = self.fixEvent(evt);
context[callback](evt);
}
if(node.attachEvent)node.attachEvent('on' + evtType, handler);
else node.addEventListener(evtType, handler, false);
context._handles.push({
node:node,
type:evtType,
handler:handler
});
}
,destroy: function(){
var ieListener = this.cropNode && this.cropNode.attachEvent;
for(var x = 0;x<this._handles.length;x++){
var handle = this._handles[x];
if(ieListener) handle.node.detachEvent('on' + handle.type, handle.handler);
else handle.node.removeEventListener(handle.type, handle.handler, false);
}
this._handles = null;
this.cropNode && this.cropNode.parentNode.removeChild(this.cropNode);
this.cropNode = null;
this.imageNode && this.imageNode.parentNode.removeChild(this.imageNode);
this.imageNode = null;
this.preview && this.preview.parentNode.removeChild(this.preview);
this.preview = null;
this.domNode && this.domNode.parentNode.removeChild(this.domNode);
this.domNode = null;
}
I'm seeing document based mouseevents that keep firing (and generating exceptions) even when references to icropper have been nulled.