Skip to main content

Bug Tracker

Side navigation

#12560 closed bug (notabug)

Opened September 18, 2012 09:33PM UTC

Closed September 18, 2012 10:44PM UTC

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

Reported by: mageluingil@gmail.com 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.

Attachments (0)
Change History (1)

Changed September 18, 2012 10:44PM UTC by dmethvin comment:1

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.