If you haven’t seen the livequery plugin, I would recommend looking it over
– this would really be the correct solution to this.

 

http://brandonaaron.net/docs/livequery/

 

Destroying events connected to a removed element helps prevent memory leaks
– it is really the correct behavior.

 

JK

 

  _____  

From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Felix Geisendörfer
Sent: Tuesday, November 06, 2007 1:46 PM
To: jquery-en@googlegroups.com
Subject: [jQuery] remove() deletes events in jQuery 1.2.1. Why?

 

Hey,

I recently upgraded my app from jQuery 1.3.1 to 1.2.1 and the transition was
incredibly easy.

However, yesterday I noticed that $().remove() now seems to behave
differently then it did in 1.3.1. Thats because now it deletes any events
attached to the element removed. This happens to be a problem in my app b/c
I remove unneeded elements from the DOM instead of hiding them and inject
them back in later on. So when they are injected again, they suddenly don't
"work" anymore : ).

Now I looked through the manual and it says this is going to be the expected
behavior in 1.2.2:

http://docs.jquery.com/Manipulation/remove

Which confuses me b/c it already seems to be the case in 1.2.1 and I'm also
wondering how I could remove DOM elements without deleting their events in
future? I'm also curious about why this change is being made, is it some
anti-memory leak thingy? 

Thanks a lot,
-- Felix
--------------------------
Blogger: http://www.thinkingphp.org/
Entrepreneur: http://www.posttask.com/ -- currently in private beta, ask me
for invite / password
Freelancer: http://www.fg-webdesign.de/


AIM:

theundefined87


Skype:

TimeFor23


Other IM:

felixge.de <http://felixge.de/> 


Mobile (USA):

+1 404 3888693


Mobile (GER):

+49 162 9391612


Twitter:

http://twitter.com/felixge

 

Reply via email to