Bug Tracker

Opened 7 years ago

Closed 7 years ago

#12560 closed bug (notabug)

jQuery's detach is calling Prototype's remove, even in noConflict mode

Reported by: mageluingil@… Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.8.1
Keywords: Cc:
Blocked by: Blocking:

Description

When an animation, using jQuery's detach function for the callback, is queued on an element twice, the detach function fails, and tries to run Prototype's remove function, which throws an error.

Demonstration: http://jsfiddle.net/67MfS/3/ Click the show/hide button, then click it again while the fadeOut animation is running. The console will show "TypeError: element.parentNode is null" in prototype.js.

I'm not sure if the problem is occurring when the callback is called, or when the second fadeOut attempts to run on the already detached element (though the element does not appear to be detaching). In either case, however, the prototype function should *not* be trying to run. jQuery usually fails much more gracefully when it cannot find the matching element.

Tested using Prototype 1.7 and both jQuery 1.7.1 and 1.8.1, in Firefox 15, Chrome 21, and IE7-IE9. (Both Windows and Linux for FF and Chrome) The behavior does *not* appear in IE8, for whatever reason.

Change History (1)

comment:1 Changed 7 years ago by dmethvin

Resolution: notabug
Status: newclosed

saveIt = jQuery('#targetDiv').fadeOut('slow',jQuery.fn.detach);

The .fadeOut method calls the callback once for each element animated, with this set to the DOM element not the jQuery object.

Note: See TracTickets for help on using tickets.