Ticket #6955 (closed bug: duplicate)

Opened 3 years ago

Last modified 3 years ago

jQuery 1.5 BREAKS UI Draggable with helper:clone option

Reported by: jquery-dev Owned by:
Priority: minor Milestone: 1.9.0
Component: ui.draggable Version: 1.8.9
Keywords: Cc:
Blocking: Blocked by:

Description

I don't know if this is a bug in UI Draggable, UI Widget Factory, or in jQuery 1.5, but I'm posting it as a Draggable bug because this is the widget affected by it...

When jQuery 1.5 is used with UI 1.8.9, the Draggable widget is BROKEN if this option is used:

$("#elem").draggable({
    helper: "clone"
});

The Draggable widget initializes correctly, but as soon as the element is dragged *one time*, the widget destroy()s itself!

The issue disappears when jQuery 1.4.4 is used. I traced the flow of events, but am unable to find what has changed in jQuery 1.5 to trigger this problem.

The problem starts with the Draggable remove() method, which is called to remove the _temporary_ helper-element. However this is handled as if the _original_ element is being removed from the DOM, and so the Draggable destroy() method is called to unbind all event handlers.

This is a major bug that breaks ANY widget or code that uses the helper:clone option.

I created a clear, simple demo of this problem here:

 http://layout.jquery-dev.net/samples/ui_draggable_bug.html

This issue has broken my widget, which is used on hundreds of websites. Therefore all these websites are unable to upgrade to jQuery 1.5, so it is generating a lot of complaints. Normally I'd provide a patched version of UI for users until an updated version is released, but this time I am unable to trace the root problem due to the long, complex sequence of calls back and forth between the jQuery and UI libraries.

I hope this very serious bug will get prompt attention. If it's really a bug in jQuery 1.5 - and not a logic bug in UI that 1.5 has 'exposed' - please let me know ASAP so I can post it as a jQuery bug instead.

Thanks in advance.

Change History

comment:1 Changed 3 years ago by scott.gonzalez

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

comment:2 Changed 3 years ago by scott.gonzalez

Duplicate of #6922.

comment:3 Changed 3 years ago by jquery-dev

Actually this is NOT a duplicate of the other bug #6922. This post discusses a different widget and the bug causes a completely different problem than described in #6922! However the same error in the jQuery clone() method does cause both problems, so the patch to address the Sortable issue 'fixes' the Draggable issue at the same time.

Just clarifying this for anyone who finds this post and is confused why these 2 different bugs have been grouped together.

comment:4 Changed 3 years ago by scott.gonzalez

Yeah, I changed the summary of the original ticket to be very generic because I anticipated a lot of similar tickets.

Note: See TracTickets for help on using tickets.