Skip to content
This repository has been archived by the owner on Mar 27, 2019. It is now read-only.

destroy() does properly unbind all events (v4.1.4) #68

Closed
bgstaal opened this issue Jun 17, 2011 · 3 comments
Closed

destroy() does properly unbind all events (v4.1.4) #68

bgstaal opened this issue Jun 17, 2011 · 3 comments

Comments

@bgstaal
Copy link

bgstaal commented Jun 17, 2011

The resize event handler is fired even after an iScroll instance is destroyed. This also results in the iScroll object never being garbage-collected.

example:


// first add console.log('resize'); to the _resize() method of iScroll at line 214

window.onload = function ()
{
    var div = document.createElement('div');
    div.id = 'myDiv';
    var ul = document.createElement('ul');
    div.appendChild(ul);
    document.body.appendChild(div);

    var scroll = new iScroll('myDiv');
    scroll.destroy();
    scroll = null;
}

Then check console to see that the _resize method is still being executed when the browser window is resized

@cubiq
Copy link
Owner

cubiq commented Jun 17, 2011

thanks for the report. this is an easy fix

@bgstaal
Copy link
Author

bgstaal commented Jun 17, 2011

Wow! Fast response! :-)

@bgstaal bgstaal closed this as completed Jun 17, 2011
@bgstaal bgstaal reopened this Jun 17, 2011
@cubiq
Copy link
Owner

cubiq commented Jun 17, 2011

should be fixed in 4.1.5

@cubiq cubiq closed this as completed Jun 17, 2011
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants