The change was deliberate, because most people use remove() to
(literally) remove the element(s) in question, and any bound events
were getting left behind in the jQuery data cache (along with any
other element-assigned data held there) and possibly causing memory
leakage.

If you want to keep an element for possible later re-insertion then
instead of removing it you might simply either hide() it in place, or
create something like a trash bin (<div id='trash'
style='display:none;'></div>) and move temporarily unwanted elements
there.

Alternatively, I *think* you could use the native removeChild() method
on the element, store the return, and later re-insert it (natively
again). This would leave jQuery's data cache in place for the element
so any bound events or element-assigned data *should* still be there.
Of course, you could then be incurring the same probability of memory
leakage that the change was put in place to prevent!

On Oct 16, 11:21 pm, Collin Allen <[EMAIL PROTECTED]> wrote:
> Hello again all!
>
> I just upgraded one of my web apps to jQuery 1.2.1, and noticed
> that .remove() no longer retains event handler bindings (i.e., if I
> have a .click() bound to an element). Previously, I was assigning the
> the return value of .remove() to a variable to stash a small chunk of
> the page in memory, and append it back in later on. In jQuery 1.1.2, I
> could recall it from memory, complete with previously bound click
> events and all, but in 1.2.1 it doesn't appear to work that way. Is
> there a better way to go about this and make it work in 1.2.1?
>
> Thanks for your continued support for such a great library!
>
> (Apologies if this shows up twice -- my initial post didn't appear,
> even after a few hours...)

Reply via email to