Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 23 additions & 7 deletions event/drag/drag.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ steal('jquery', 'jquery/lang/vector', 'jquery/event/livehack', 'jquery/event/rev
dragover: event.find(delegate, ["dragover"], selector),
dragmove: event.find(delegate, ["dragmove"], selector),
dragout: event.find(delegate, ["dragout"], selector),
dragend: event.find(delegate, ["dragend"], selector)
dragend: event.find(delegate, ["dragend"], selector),
dragcleanup: event.find(delegate, ["dragcleanup"], selector),
},
destroyed: function() {
self.current = null;
Expand Down Expand Up @@ -404,15 +405,15 @@ steal('jquery', 'jquery/lang/vector', 'jquery/event/livehack', 'jquery/event/rev
});
}
else {
this.cleanup();
this.cleanup(event);
}
this.event = null;
},
/**
* Cleans up drag element after drag drop.
* @hide
*/
cleanup: function() {
cleanup: function(event) {
this.movingElement.css({
zIndex: this.oldZIndex
});
Expand All @@ -427,6 +428,8 @@ steal('jquery', 'jquery/lang/vector', 'jquery/event/livehack', 'jquery/event/rev
// Remove the element when using drag.ghost()
this.movingElement.remove();
}

this.callEvents('cleanup', this.element, event);

this.movingElement = this.element = this.event = null;
},
Expand Down Expand Up @@ -713,17 +716,30 @@ steal('jquery', 'jquery/lang/vector', 'jquery/event/livehack', 'jquery/event/rev
* @attribute dragend
* @parent jQuery.event.drag
*
* `dragend` is called when the drag motion is done.
* `dragend` is called when the drag operation is completed.
* The event handler gets an instance of [jQuery.Drag] passed as the second
* parameter.
*
* $('.draggable').on('dragend', function(ev, drag)
* // Clean up when the drag motion is done
* // Calculation on whether revert should be invoked, alterations based on position of the end event
* });
*/
'dragend'], startEvent, function( e ) {
'dragend',
/**
* @attribute dragcleanup
* @parent jQuery.event.drag
*
* `dragcleanup` is called after dragend and revert (if applied)
* The event handler gets an instance of [jQuery.Drag] passed as the second
* parameter.
*
* $('.draggable').on('dragcleanup', function(ev, drag)
* // cleanup
* });
*/
'dragcleanup'], startEvent, function( e ) {
$.Drag.mousedown.call($.Drag, e, this);
});

return $;
});
});