jquery/jquery-ui — pull request #501 by maljub01 (2011-10-17 16:42:58+00:00)
Title: Fixed ticket #7800 - Draggable helper="clone" doesn't remove the dragged clone if original element is removed upon drop

Fixed ticket: http://bugs.jqueryui.com/ticket/7800

Test case here: http://jsfiddle.net/maljub01/btESH/

Another (more useful) test case: http://jsfiddle.net/maljub01/mJZva/

This fix has two parts, the first, in Draggable, prevents it from aborting mouseStop when the element is gone if the helper is !== "original". Returning the modified if statement to the way it looked in v1.8.16.

The second part, in Core, was necessary for IE8 and older versions of IE. This is because for old IE, parentNode returns a node with nodeType === 11 (DOCUMENT_FRAGMENT_NODE) for elements that have no parent.

At first I wanted to add the nodeType === 11 check to the modified line in Draggable to avoid modifying Core. However, the error persists even if the check was added there.

Here's a test case, with the option of monkey-patching jQuery UI with this commit's modifications: http://jsfiddle.net/maljub01/ahyfr/