Skip to content
Open
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
Allow using a Function as the cancel option instead of a Selector. Th…
…is is particularly useful when using Sortable on nested lists.
  • Loading branch information
kghandi committed Jan 28, 2025
commit af50299fb12de9527f84e07b884f49436bec9fad
8 changes: 5 additions & 3 deletions ui/widgets/mouse.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,11 @@ return $.widget( "ui.mouse", {

var that = this,
btnIsLeft = event.which === 1,
elIsCancel = typeof this.options.cancel === "string" ?
$( event.target ).closest( this.options.cancel ).length :
false;
elIsCancel = typeof this.options.cancel === "function" ?
this.options.cancel.call( event.target, event ) :
( typeof this.options.cancel === "string" ?
$( event.target ).closest( this.options.cancel ).length :
false );
if ( !btnIsLeft || elIsCancel || !this._mouseCapture( event ) ) {
return true;
}
Expand Down