Skip to main content

Search and Top Navigation

#6955 closed bug (duplicate)

Opened February 08, 2011 05:55PM UTC

Closed February 08, 2011 06:02PM UTC

Last modified February 08, 2011 08:41PM UTC

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

Attachments (0)
Change History (4)

Changed February 08, 2011 06:02PM UTC by scottgonzalez comment:1

resolution: → duplicate
status: newclosed

Changed February 08, 2011 06:02PM UTC by scottgonzalez comment:2

Duplicate of #6922.

Changed February 08, 2011 08:13PM UTC by jquery-dev comment:3

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.

Changed February 08, 2011 08:41PM UTC by scottgonzalez comment:4

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