Skip to content

Commit 201b5ed

Browse files
kzysscottgonzalez
authored andcommitted
Draggable: Remove id when cloning helpers. Fixes #4564 - Draggable+Sortable Demo duplicates DOM Ids.
(cherry picked from commit 98fcb47)
1 parent 5e1032e commit 201b5ed

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ui/jquery.ui.draggable.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ $.widget("ui.draggable", $.ui.mouse, {
261261
_createHelper: function(event) {
262262

263263
var o = this.options;
264-
var helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event])) : (o.helper == 'clone' ? this.element.clone() : this.element);
264+
var helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event])) : (o.helper == 'clone' ? this.element.clone().removeAttr('id') : this.element);
265265

266266
if(!helper.parents('body').length)
267267
helper.appendTo((o.appendTo == 'parent' ? this.element[0].parentNode : o.appendTo));
@@ -580,7 +580,7 @@ $.ui.plugin.add("draggable", "connectToSortable", {
580580
//Now we fake the start of dragging for the sortable instance,
581581
//by cloning the list group item, appending it to the sortable and using it as inst.currentItem
582582
//We can then fire the start event of the sortable with our passed browser event, and our own helper (so it doesn't create a new one)
583-
this.instance.currentItem = $(self).clone().appendTo(this.instance.element).data("sortable-item", true);
583+
this.instance.currentItem = $(self).clone().removeAttr('id').appendTo(this.instance.element).data("sortable-item", true);
584584
this.instance.options._helper = this.instance.options.helper; //Store helper option to later restore it
585585
this.instance.options.helper = function() { return ui.helper[0]; };
586586

0 commit comments

Comments
 (0)