Thanks for the reply.
I do understand that "Just because an element has been detached from the
visible DOM doesn't
mean that the reference can be maintained elsewhere."  I just assumed that
once it is detached, and the object isn't referenced
anywhere else in the code that it would be collected by garbage collection,
just like any other variable:

function test() {
  var i = 0;
  var j = $('some-element').remove();
}

it's my thinking that after test() has finished running, that both i and j
would be picked up by garbage collection.  is this not true?

So, what you're saying, to answer my question, is that I don't have to worry
about using Event#stopObserving?

On Tue, Oct 6, 2009 at 10:22 AM, Matt Foster <mattfoste...@gmail.com> wrote:

>
> The removed element?
>
> Just because an element has been detached from the visible DOM doesn't
> mean that the reference can be maintained elsewhere.  It would be no
> edge case to detach and re-attach a particular element, so to think
> that an element should be trashed just because it has no parent node
> is a bad perception.
>
> Prototype has accomodations for IE's poor garbage collection tactics
> and has a cleanup method for this that gets handled transparently to
> you.
>
> --
>
> http://positionabsolute.net
>
> On Oct 6, 12:05 pm, Ngan Pham <nganp...@gmail.com> wrote:
> > Hey everyone,
> > I have a quick question.  If put some Event#observe on an element...and
> then
> > later remove the element with Element#remove, do I have to do
> > Event#stopObserving?  Or do the event detach themselves once garbage
> > collection picks up the removed element?
> >
> > Thanks!
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to