wnr / element-resize-detector

Optimized cross-browser resize listener for elements.
MIT License
1.32k stars 118 forks source link

Is it safe to remove element without remove handler ? #42

Closed zhaoyao91 closed 8 years ago

zhaoyao91 commented 8 years ago

Is it safe to remove element without remove handler ? In some cases, the element is removed without any chance to remove listeners. will this cause any problem like memory leaking?

wnr commented 8 years ago

Yes, since all listeners are attached to the element itself it should get garbage collected when removed from the DOM. We too remove the elements freely, and haven't noticed any problems.

zhaoyao91 commented 8 years ago

thanks