From 19060fcdaf64216b222f4a41f065515faf834159 Mon Sep 17 00:00:00 2001 From: snesin Date: Thu, 12 Jan 2012 17:37:43 -0600 Subject: [PATCH] Give drag.revert an optional callback to notify when revert is complete. Uses existing _revert property that was already assigned to the optional parameter. Modified end method to test if _revert is a function, and if so, call it. Modified documentation of revert method. --- event/drag/drag.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/event/drag/drag.js b/event/drag/drag.js index 78f2dfd2..8cd5b1cb 100644 --- a/event/drag/drag.js +++ b/event/drag/drag.js @@ -394,6 +394,9 @@ steal('jquery/event', 'jquery/lang/vector', 'jquery/event/livehack',function( $ top: this.startPosition.top() + "px", left: this.startPosition.left() + "px" }, function() { + if ( typeof self._revert == "function" ) { + self._revert(); + } self.cleanup.apply(self, arguments); }); } @@ -482,7 +485,7 @@ steal('jquery/event', 'jquery/lang/vector', 'jquery/event/livehack',function( $ * drag.revert() * } * @codeend - * @param {Boolean} [val] optional, set to false if you don't want to revert. + * @param {Boolean} [val] optional, set to false if you don't want to revert, or a callback function which occurs when revertion is complete. */ revert: function( val ) { this._revert = val === undefined ? true : val;