admin管理员组文章数量:1310519
This question was asked and answered in 2011. However, the web scene has taken a considerable change and now IE6 and IE7 are out, IE8-10 are barely out (under 1% each) and only IE11 is still there.
So, in 2016, do you need to manually remove event listeners to avoid memory leaks? Consider only IE11 for the answer please. I am asking because I created a small library as an alternative to jQuery and would love to know if I have to remove them manually first. Of course the question is when using vanilla javascript, not jQuery.
This question was asked and answered in 2011. However, the web scene has taken a considerable change and now IE6 and IE7 are out, IE8-10 are barely out (under 1% each) and only IE11 is still there.
So, in 2016, do you need to manually remove event listeners to avoid memory leaks? Consider only IE11 for the answer please. I am asking because I created a small library as an alternative to jQuery and would love to know if I have to remove them manually first. Of course the question is when using vanilla javascript, not jQuery.
Share Improve this question edited Sep 19, 2019 at 17:34 Brian Tompsett - 汤莱恩 5,89372 gold badges61 silver badges133 bronze badges asked Apr 21, 2016 at 3:44 Francisco PresenciaFrancisco Presencia 8,8587 gold badges49 silver badges94 bronze badges 1- 1 Hey @BrianTompsett-汤莱恩, as you can see there is a 5 year gap and that makes a world of a difference. In the linked question, the answer is "yes", while when I asked this question in 2016 the answer was "no". So it's definitely not a duplicate. – Francisco Presencia Commented Sep 20, 2019 at 16:56
1 Answer
Reset to default 9No
See these answers:
- Do I need to remove event listeners?
- If a DOM Element is removed, are its listeners also removed from memory?
Also:
- This article claims the DOM + JS reference cycle memory leak was fixed in IE8.
Edit: The article linked above is gone. Here is a wayback machine snapshot.
本文标签: javascriptDo I need to remove event listeners in 2016Stack Overflow
版权声明:本文标题:javascript - Do I need to remove event listeners in 2016? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741826803a2399693.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论