There is no method Element.remove(). Only Element.dispose() (which removes
it from the DOM, but it can be injected again later; it still exists) and
Element.destroy() which removes it from memory entirely. The destroy method
obviously removes any events attached to it.

On Tue, Apr 14, 2009 at 6:34 PM, Steve Onnis (via Nabble) <
[email protected]<ml-user%[email protected]>
> wrote:

>
> remove() only removes the element but the events stay in memory so before
> you call remove() call removeEvents() also on the element
>
> -----Original Message-----
> From: 
> mootools-us...@...<http://n2.nabble.com/user/SendEmail.jtp?type=node&node=2636365&i=0>
> [mailto:mootools-us...@...<http://n2.nabble.com/user/SendEmail.jtp?type=node&node=2636365&i=1>]
> On Behalf Of electronbender
> Sent: Wednesday, 15 April 2009 1:21 AM
> To: MooTools Users
> Subject: [Moo] Re: Multiple events applied
>
>
> Ok, what i've done is do a removeEvents before setting the event, so
> that appears to work.
>
> On Apr 14, 4:52 pm, Thierry bela nanga 
> <bna...@...<http://n2.nabble.com/user/SendEmail.jtp?type=node&node=2636365&i=2>>
> wrote:
> > I think remove does the same as dispose,
> > it remove the element from the DOM.
> >
> > 2009/4/14 Fábio Costa 
> > <fabiomco...@...<http://n2.nabble.com/user/SendEmail.jtp?type=node&node=2636365&i=3>>
>
> >
> >
> >
> > > remove sould be equal to dispose.
> > > Isn't it?
> >
> > > Fábio Miranda Costa
> > > Engenheiro de Computação
> > >http://meiocodigo.com
> >
> > > On Tue, Apr 14, 2009 at 11:45 AM, electronbender <
> > > ognen.plavev...@...<http://n2.nabble.com/user/SendEmail.jtp?type=node&node=2636365&i=4>>
> wrote:
> >
> > >> No dispose in 1.11 :(
> >
> > >> On Apr 14, 4:44 pm, Fábio Costa 
> > >> <fabiomco...@...<http://n2.nabble.com/user/SendEmail.jtp?type=node&node=2636365&i=5>>
> wrote:
> > >> > Don't know moo 1.1 :S
> > >> > But looks like a dispose, so maybe i've helped.
> >
> > >> > Fábio Miranda Costa
> > >> > Engenheiro de Computaçãohttp://meiocodigo.com
> >
> > >> > On Tue, Apr 14, 2009 at 11:42 AM, electronbender
> > >> > <ognen.plavev...@...<http://n2.nabble.com/user/SendEmail.jtp?type=node&node=2636365&i=6>>wrote:
>
> >
> > >> > > Using moo 1.11..
> > >> > > I just checked and i do a .remove() on the parent div.
> >
> > >> > > On Apr 14, 4:16 pm, Fábio Costa 
> > >> > > <fabiomco...@...<http://n2.nabble.com/user/SendEmail.jtp?type=node&node=2636365&i=7>>
> wrote:
> > >> > > > Are you destroying or disposing the element?
> > >> > > > There are 2 methods to remove elements from the DOM, destroy()
> and
> > >> > > > dispose().
> > >> > > > destroy() removes the element from the DOM and really destroy it
>
> and
> > >> its
> > >> > > > references and, i think, everything related to it (events
> included).
> > >> > > > dispose() removes the element from the DOM, and that's it.
> >
> > >> > > > So... you might be using dispose. And that's correct as you are
> > >> removing
> > >> > > and
> > >> > > > adding it again to the DOM, it's more efficient.
> > >> > > > So just try not to re-add the event. If you still need to
> re-add,
> > >> remove
> > >> > > the
> > >> > > > old one first than add the new one.
> >
> > >> > > > Fábio Miranda Costa
> > >> > > > Engenheiro de Computaçãohttp://meiocodigo.com
> >
> > >> > > > On Tue, Apr 14, 2009 at 10:56 AM, electronbender
> > >> > > > <ognen.plavev...@...<http://n2.nabble.com/user/SendEmail.jtp?type=node&node=2636365&i=8>>wrote:
>
> >
> > >> > > > > I create a dropdown, and add a change event to it.
> >
> > >> > > > > Then i destroy the element.
> >
> > >> > > > > After a while i recreate it (same id, same name), and add the
> same
> > >> > > > > change event to it.
> > >> > > > > However, when i actually fire the change event this time
> around,
> > >> it is
> > >> > > > > fired twice!
> >
> > >> > > > > So, every time i delete, re-create it, and add the new event,
> all
> > >> the
> > >> > > > > previous events apply, plus the new one.
> >
> > >> > > > > So, question 1:
> > >> > > > > - Why? This is a new element, even though it has the same
> name,
> > >> the
> > >> > > > > event should have died with the old element?
> >
> > >> > > > > Question 2:
> > >> > > > > - How do i prevent it? Is there a way to check if an event has
>
> > >> been
> > >> > > > > applied to an element?
> >
> > --
> > fax : (+33) 08 26 51 94 51
>
>
>
> ------------------------------
>  View message @
> http://n2.nabble.com/-Moo--Multiple-events-applied-tp2633261p2636365.html
> To start a new topic under MooTools Users, email
> [email protected]<ml-node%[email protected]>
> To unsubscribe from MooTools Users, click here< (link removed) >.
>
>
>


-----
The MooTools Tutorial:  http://www.mootorial.com www.mootorial.com 
Clientcide:  http://www.clientcide.com www.clientcide.com 
-- 
View this message in context: 
http://n2.nabble.com/-Moo--Multiple-events-applied-tp2633261p2637225.html
Sent from the MooTools Users mailing list archive at Nabble.com.

Reply via email to