Skip to content

Commit 368fc83

Browse files
committed
Draggable: Clarify comments and whitespace in connectToSortable
1 parent e8c99b9 commit 368fc83

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

ui/draggable.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -732,7 +732,6 @@ $.ui.plugin.add("draggable", "connectToSortable", {
732732

733733
$.each(inst.sortables, function() {
734734
if (this.instance.isOver) {
735-
736735
this.instance.isOver = 0;
737736

738737
// Allow this sortable to handle removing the helper
@@ -751,6 +750,8 @@ $.ui.plugin.add("draggable", "connectToSortable", {
751750
//Trigger the stop of the sortable
752751
this.instance._mouseStop(event);
753752

753+
// Once drag has ended, the sortable should return to using
754+
// its original helper, not the shared helper from draggable
754755
this.instance.options.helper = this.instance.options._helper;
755756

756757
} else {
@@ -812,7 +813,7 @@ $.ui.plugin.add("draggable", "connectToSortable", {
812813
return ui.helper[ 0 ];
813814
};
814815

815-
// Fire the start event of the sortable with our passed browser event,
816+
// Fire the start events of the sortable with our passed browser event,
816817
// and our own helper (so it doesn't create a new one)
817818
event.target = sortable.currentItem[ 0 ];
818819
sortable._mouseCapture( event, true );
@@ -829,7 +830,8 @@ $.ui.plugin.add("draggable", "connectToSortable", {
829830

830831
draggable._trigger( "toSortable", event );
831832

832-
// draggable revert needs this variable
833+
// Inform draggable that the helper is in a valid drop zone,
834+
// used solely in the revert option to handle "valid/invalid".
833835
draggable.dropped = sortable.element;
834836

835837
// hack so receive/update callbacks work (mostly)
@@ -860,7 +862,6 @@ $.ui.plugin.add("draggable", "connectToSortable", {
860862
sortable.options.revert = false;
861863

862864
sortable._trigger( "out", event, sortable._uiHash( sortable ) );
863-
864865
sortable._mouseStop( event, true );
865866

866867
// restore sortable behaviors that were modfied
@@ -879,7 +880,7 @@ $.ui.plugin.add("draggable", "connectToSortable", {
879880

880881
draggable._trigger( "fromSortable", event );
881882

882-
// draggable revert needs that
883+
// Inform draggable that the helper is no longer in a valid drop zone
883884
draggable.dropped = false;
884885
}
885886
}

0 commit comments

Comments
 (0)