diff --git a/ui/widgets/mouse.js b/ui/widgets/mouse.js index ef9dd8dbe9..ce7ce8c749 100644 --- a/ui/widgets/mouse.js +++ b/ui/widgets/mouse.js @@ -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; }