This project is archived and is in readonly mode.

#1193 ✓resolved

Element.destroy does not empty or destroy element

Reported by SamGoody | March 9th, 2011 @ 10:57 AM | in 1.3.2

Very simple example of destroy:

Acc. to docs, the children are emptied and the element is garbaged.

In fact, the element is still around and healthy with all of its
children intact. See log.

Comments and changes to this ticket

  • Thomas Aylott
  • Christoph Pojer

    Christoph Pojer March 10th, 2011 @ 01:44 PM

    • State changed from “new” to “resolved”
    • Milestone set to 1.3.2
    • Assigned user set to “Christoph Pojer”
    • Milestone order changed from “892” to “0”


    thank you for your report. We forgot to update the documentation on this. Empty is not being called by Element.destroy any more and you need to call it yourself: el.empty().destroy();

    Please note that if you have a reference to an element in any place of your code that the element will stay alive and will not be garbage collected. The idea of destroy is to remove all of the internally stored variables (tween instances and others) so it can be garbage collected.

    Example (in a class method):

    this.element = new Element('div').adopt(new Element('p'));
    this.element = null;

    Note that it is not really necessary to call "empty" here.

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Shared Ticket Bins

People watching this ticket

Referenced by