Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!news2.arglkargh.de!news.albasani.net!weretis.net!feeder1.news.weretis.net!news.solani.org!.POSTED!not-for-mail From: Thomas 'PointedEars' Lahn Newsgroups: comp.lang.javascript Subject: Re: Is it necessary to explicitly destroy elements? Date: Sat, 16 May 2015 18:12:40 +0200 Organization: PointedEars Software (PES) Lines: 30 Message-ID: <8185458.TY0rIKgSsa@PointedEars.de> References: Reply-To: Thomas 'PointedEars' Lahn Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8Bit X-Trace: solani.org 1431792919 32707 eJwFwYERADAEBLCVKP9qHPTsP0ITGJUTTtCx2C28EymiDqElMddOvrKFndFoDa1bE7Hd2R8CkxCf (16 May 2015 16:15:19 GMT) X-Complaints-To: abuse@news.solani.org NNTP-Posting-Date: Sat, 16 May 2015 16:15:19 +0000 (UTC) User-Agent: KNode/4.14.2 X-User-ID: eJwVyMERwCAIBMCWVOA4yzGc9F9Ckpl9bRgmKh0Bj46GimdpXUW2Ui0XiVtz1+NtaarGDm4b1CjCwc/66/h5AXfGFZo= Cancel-Lock: sha1:OGfA9T3xHPTsV9JU9qUEwJgVU8s= X-NNTP-Posting-Host: eJwFwQkBwEAIAzBNB7QMObz+JSyB8rHdCBoOJyeyQO2A4iNTHb0L+yg5nuUZF2lvqkKpPy6FEck= Xref: csiph.com comp.lang.javascript:27695 Leonardo Azpurua wrote: > "Stefan Ram" […] >> "Leonardo Azpurua" writes: >>> […] do most "modern" browsers (say FireFox, Chrome, IE9+, Opera, Safari) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >>> automatically handle all the cleanup of a disposed element (detaching >>> event handlers, freeing graphical resources, deallocating memory, etc) >>> for all the elemets inside a disposed control, or is it necessary to >>> provide a function to handle all of it explicitly? >> >> The garbage collectors should take care of JavaScript objects and of >> DOM objects. But some collectors cannot clean up in all situations. >> To be on the safe side: >> >> - avoid circular references between JavaScript objects and DOM objects >> - avoid using closure variables in event handlers >> - avoid using inline event handlers (onclick='f()') >> - avoid using expando properties >> - nullify expando properties and DOM references when not needed anymore > > Nice! And wrong. -- PointedEars FAQ: | SVN: Twitter: @PointedEars2 | ES Matrix: Please do not cc me. / Bitte keine Kopien per E-Mail.