Skip to content

Commit af50299

Browse files
committed
Allow using a Function as the cancel option instead of a Selector. This is particularly useful when using Sortable on nested lists.
1 parent b685753 commit af50299

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

ui/widgets/mouse.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,11 @@ return $.widget( "ui.mouse", {
9090

9191
var that = this,
9292
btnIsLeft = event.which === 1,
93-
elIsCancel = typeof this.options.cancel === "string" ?
94-
$( event.target ).closest( this.options.cancel ).length :
95-
false;
93+
elIsCancel = typeof this.options.cancel === "function" ?
94+
this.options.cancel.call( event.target, event ) :
95+
( typeof this.options.cancel === "string" ?
96+
$( event.target ).closest( this.options.cancel ).length :
97+
false );
9698
if ( !btnIsLeft || elIsCancel || !this._mouseCapture( event ) ) {
9799
return true;
98100
}

0 commit comments

Comments
 (0)