Opened 9 years ago

Closed 7 years ago

#7000 closed bug (wontfix)

Draggable: does not detect nested, removed Draggable when element is removed during drag

Reported by: PvZ Owned by:
Priority: minor Milestone: 2.0.0
Component: ui.draggable Version: 1.8.9
Keywords: Cc:
Blocked by: Blocking:

Description

Draggable does not seem to correctly detect that the original Draggable has been removed if it was part of a larger section that got removed as a whole. An example can be found at jsfiddle.

My attempt to isolate the bug pointed me to the following statement in Draggable (around line 197):

//if the original element is removed, don't bother to continue
if(!this.element[0] || !this.element[0].parentNode)
    return false;

When the Draggable itself hasn't been removed from its parent, but the parent has been removed from the DOM, this test will evaluate to false and execution will continue. The situation only gets worse in Internet Explorer as a removed element seems to have a parentNode of type DOCUMENT_FRAGMENT_NODE, which means this test will always evaluate to false.

Change History (5)

comment:1 Changed 7 years ago by Scott González

Milestone: 1.9.02.0.0

comment:2 Changed 7 years ago by mikesherov

Status: newopen
Summary: Draggable does not detect nested, removed DraggableDraggable: does not detect nested, removed Draggable when element is removed during drag

confirmed: http://jsfiddle.net/yZmxT/ and related to #6999 and #6871

comment:3 Changed 7 years ago by mikesherov

Resolution: duplicate
Status: openclosed

Duplicate of #8269.

comment:4 Changed 7 years ago by mikesherov

Resolution: duplicate
Status: closedreopened

comment:5 Changed 7 years ago by mikesherov

Resolution: wontfix
Status: reopenedclosed

In fact, this seems like a duplicate, but is slightly different. We're only going to support removing the original on "end" callbacks. In this case, that's "stop" for draggables. I'll open a docs issue shortly to document this.

Note: See TracTickets for help on using tickets.