Skip to content

Fixed ticket #7800 - Draggable helper="clone" doesn't remove the dragged clone if original element is removed upon drop #501

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 17, 2011

Conversation

maljub01
Copy link
Contributor

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/

…e the dragged clone if original element is removed upon drop
@maljub01
Copy link
Contributor Author

By the way, this bug also exists in v1.8.16 under old IE, and is fixed by modifying Core the same way.

scottgonzalez added a commit that referenced this pull request Nov 17, 2011
Fixed ticket #7800 - Draggable helper="clone" doesn't remove the dragged clone if original element is removed upon drop
@scottgonzalez scottgonzalez merged commit 69f6f58 into jquery:master Nov 17, 2011
@pwmckenna
Copy link

This is not quite the same as if the original is removed while still dragging the clone around correct? I am getting my clone stuck if the original disappears mid drag, and I have a pretty simple fix for that case. Worth a pull request?

@scottgonzalez
Copy link
Member

Please file a bug report and provide a reduced test case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants