Skip to content

Commit d32183e

Browse files
committed
Draggable: Fixed backCompat for appendTo when no helper exists
1 parent 9990013 commit d32183e

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

ui/jquery.ui.draggable.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,13 @@ $.widget( "ui.draggable", $.ui.interaction, {
8585

8686
// Reset
8787
this.dragDimensions = null;
88-
88+
8989
// The actual dragging element, should always be a jQuery object
9090
this.dragEl = ( this.options.helper === true || typeof this.options.helper === "function" ) ?
9191
this._createHelper( pointerPosition ) :
9292
this.element;
93+
94+
9395

9496
// _createHelper() ensures that helpers are in the correct position
9597
// in the DOM, but we need to handle appendTo when there is no helper
@@ -564,11 +566,17 @@ if ( $.uiBackCompat !== false ) {
564566
// appendTo 'parent' value
565567
$.widget( "ui.draggable", $.ui.draggable, {
566568

569+
// Helper passed in since _createHelper calls this before dragEl is set
567570
_appendToEl: function() {
568571

569572
var el = this.options.appendTo;
570-
571-
if ( el === "parent" || el === null ) {
573+
574+
// This should only happen via _createHelper
575+
if ( el === null ) {
576+
return this.element.parent();
577+
}
578+
579+
if ( el === "parent" ) {
572580
el = this.dragEl.parent();
573581
}
574582

0 commit comments

Comments
 (0)