Sorry, maybe this one will be better: garbage:(function(splice){ return function(){ var length = this.length; while(length){ if(!contains(this.context, this[--length])) jQuery.remove.call(splice.call(this, length, 1)); }; return this; }; })(Array.prototype.splice),
Regards On Tue, Aug 18, 2009 at 4:21 PM, Andrea Giammarchi < andrea.giammar...@gmail.com> wrote: > What a bout a garbage collector prototype method? Is there any plugin like > this? > > garbage:(function(splice){ > return function(){ > var length = this.length; > while(length){ > if(!contains(this.context, this[--length])) > splice.call(this, length, 1); > }; > return this; > }; > })(Array.prototype.splice), > > The problem is that to use the jQuery contains function it requires to be > inside the library since if I am not wrong contains is not exposed. > > What do you think? > > > On Tue, Aug 18, 2009 at 4:00 PM, John Resig <jere...@gmail.com> wrote: > >> >> Not really, right? You can still modify and re-place nodes that have >>> been removed from the dom, but not on nodes that have been destroyed. >>> >>> <div id="bar"><p>hi</p><p>there</p></div> >>> >>> var ps = $("#bar p").remove(); >>> $("#bar").html("<p>hmm</p>"); >>> ps.appendTo("#bar") >>> >>> or some such. >>> >> >> Removed from the DOM via an innerHTML or removed from the DOM via a >> removeChild - the result is the same either way. A reference to the DOM >> element should be maintained so that further operations can be performed. >> >> --John >> >> >> >> >> > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---