ded / bonzo

library agnostic, extensible DOM utility
Other
1.32k stars 137 forks source link

Clean element data on removal #43

Closed amccollum closed 13 years ago

amccollum commented 13 years ago

I updated this pull request to merge cleanly. This is important to prevent memory leaks, which as is, make .data() pretty much a non-starter for large web apps. Also, I'm working on implementing an Ender module that emulates jQuery.widget, and data removal is a necessity.

Is there anything else that you guys would want to see before accepting this pull request?

ded commented 13 years ago

right on.

Is there anything else that you guys would want to see before accepting this pull request?

Not that I can say. This seems good. I noticed your coffee script programming come through in the tests. Lol. No big deal ;) I also noticed you forked bean which I imagine will have a similar issue on memory leaks

amccollum commented 13 years ago

There is a general problem that you would like an event to be fired on element removal so that all libraries that reference the dom can clean up their additions. However, since Bonzo and Bean are currently independent of one another, I'm not sure how this would be done in a compatible way.

John Resig has talked about adding this to jQuery (it already exists in jQuery UI), but to my knowledge, it hasn't been done.

http://groups.google.com/group/jquery-dev/browse_thread/thread/0f56e5c1b29f30a1?pli=1

rvagg commented 13 years ago

see also https://github.com/ender-js/Ender/issues/87