Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing bindings to avoid memory leaks #85

Merged
merged 1 commit into from
Sep 1, 2014
Merged

Removing bindings to avoid memory leaks #85

merged 1 commit into from
Sep 1, 2014

Conversation

jlcarvalho
Copy link
Contributor

In your Directive keep practice for unbinding the jQuery Event. $destory Method which can be used to clean up DOM bindings before an element is removed from the DOM.

In your Directive keep practice for unbinding the jQuery Event. $destory Method which can be used to clean up DOM bindings before an element is removed from the DOM.
AidasK added a commit that referenced this pull request Sep 1, 2014
fix: removing bindings to avoid memory leaks
@AidasK AidasK merged commit 865b845 into flowjs:master Sep 1, 2014
@AidasK
Copy link
Member

AidasK commented Sep 1, 2014

Nice, thanks

@jlcarvalho jlcarvalho deleted the patch-1 branch September 1, 2014 14:35
@AidasK
Copy link
Member

AidasK commented Sep 4, 2014

Hi, I haven't time to write this earlier, but I think I submitted this request too early.
You don't need to unbind events on destroy, because destroy event is called once DOM element is destroyed.
I have also check angularjs directives and they also follows same approach (don't unbind events):
https://github.com/angular/angular.js/blob/master/src/ng/directive/ngEventDirs.js#L61

@jlcarvalho
Copy link
Contributor Author

Yes, but when i remove one element the events are not removed. Right?
In modern js engines it's not a problem, and i agree with you. But in the others?

Check this links:
angular/angular.js#4864
angular/angular.js#5270
angular/angular.js#5281

@AidasK
Copy link
Member

AidasK commented Sep 4, 2014

Yea, but as I can see, they have decided to do nothing about it, right?
angular/angular.js#5281 (comment)
So I don't think we should solve problems which are left in the angularjs core. Libraries should follow same style.

@jlcarvalho
Copy link
Contributor Author

Ok, you're right. We must follow the same style.

By the way, sorry for my english.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants