@Michael

ok, I just missed the fact I am delete-ing a local var-iable. Which
made me think:

// no var, orphan is global, delete does work
orphan = this.parentNode.removeChild(this); delete orphan ;

I think dojo solves this by having a global array of orphans, which (I
think) is deleted upon unload ... so something like this :

global_orphans_array.push (  this.parentNode.removeChild(this) ) ;

might be better (no global orphan var's).
afterwards in window "unload" handler delete elements of  the global
array of orphans ...

--DBJ

On Apr 20, 4:19 pm, "Michael Geary" <m...@mg.to> wrote:
> > > var orphan = this.parentNode.removeChild(this);
> > > delete orphan;  // DBJ added delete
>
> > > I think this might make jQ much slower ?
> > Just tested it, and this doesn't seem to fix the problem either :(
>
> Assuming that this code is inside a function, it could never fix a leak, but
> it could create one.
>
> The delete operator doesn't work on a local variable. It leaves the variable
> unchanged and returns false.
>
> So this delete can't help. But the "var orphan =" could cause a leak if this
> function invocation is kept around because of a closure.
>
> If you do want to remove a reference in a local variable, set it to null or
> undefined:
>
>   var orphan = this.parentNode.removeChild(this);
>   // do something with orphan here?
>   orphan = null;
>
> But if you're not using that "orphan" variable for anything, that code is
> equivalent to not having the variable at all:
>
>   this.parentNode.removeChild(this);
>
> -Mike
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to jquery-dev@googlegroups.com
To unsubscribe from this group, send email to 
jquery-dev+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to