Bug Tracker

Modify

Ticket #12560 (closed bug: notabug)

Opened 9 months ago

Last modified 9 months ago

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:
Blocking: Blocked by:

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

comment:1 Changed 9 months ago by dmethvin

  • Status changed from new to closed
  • Resolution set to notabug

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.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.