Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Element.empty does not destroy #2155

ibolmo opened this Issue · 1 comment

1 participant

Olmo Maldonado
Olmo Maldonado

As of 1.4.2:

    empty: function(){
        while (this.length) delete this[--this.length];
        return this;

Why aren't we:

    empty: function(){
        while (this.length) this[--this.length].destroy();
        return this;
Olmo Maldonado

@cpojer @arian I've been thinking about this. Technically empty in Array.js doesn't do anything to the objects inside, it just removes them from the array. Which is what's currently done in 1.4.2. Perhaps just a special note in the docs will suffice to express a best practice:


Elements.empty does not destroy the elements inside. As best practice, always destroy your elements if they're no longer in use. For example:

Olmo Maldonado ibolmo referenced this issue from a commit in ibolmo/mootools-core
Olmo Maldonado ibolmo Fixes #2155.
Added Notes and See Also for `Elements.empty` to use `Element.destroy`
when appropriate.
Olmo Maldonado ibolmo closed this in bf35c9f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.