@@ -519,7 +519,7 @@ Sortable.prototype = /** @lends Sortable.prototype */ {
519519 fromEl : el
520520 } ) ;
521521 pluginEvent ( 'filter' , _this , { evt } ) ;
522- preventOnFilter && evt . cancelable && evt . preventDefault ( ) ;
522+ preventOnFilter && evt . preventDefault ( ) ;
523523 return ; // cancel dnd
524524 }
525525 }
@@ -542,7 +542,7 @@ Sortable.prototype = /** @lends Sortable.prototype */ {
542542 } ) ;
543543
544544 if ( filter ) {
545- preventOnFilter && evt . cancelable && evt . preventDefault ( ) ;
545+ preventOnFilter && evt . preventDefault ( ) ;
546546 return ; // cancel dnd
547547 }
548548 }
@@ -624,9 +624,15 @@ Sortable.prototype = /** @lends Sortable.prototype */ {
624624 on ( ownerDocument , 'mousemove' , nearestEmptyInsertDetectEvent ) ;
625625 on ( ownerDocument , 'touchmove' , nearestEmptyInsertDetectEvent ) ;
626626
627- on ( ownerDocument , 'mouseup' , _this . _onDrop ) ;
628- on ( ownerDocument , 'touchend' , _this . _onDrop ) ;
629- on ( ownerDocument , 'touchcancel' , _this . _onDrop ) ;
627+ if ( options . supportPointer ) {
628+ on ( ownerDocument , 'pointerup' , _this . _onDrop ) ;
629+ // Native D&D triggers pointercancel
630+ ! this . nativeDraggable && on ( ownerDocument , 'pointercancel' , _this . _onDrop ) ;
631+ } else {
632+ on ( ownerDocument , 'mouseup' , _this . _onDrop ) ;
633+ on ( ownerDocument , 'touchend' , _this . _onDrop ) ;
634+ on ( ownerDocument , 'touchcancel' , _this . _onDrop ) ;
635+ }
630636
631637 // Make dragEl draggable (must be before delay for FireFox)
632638 if ( FireFox && this . nativeDraggable ) {
@@ -645,9 +651,14 @@ Sortable.prototype = /** @lends Sortable.prototype */ {
645651 // If the user moves the pointer or let go the click or touch
646652 // before the delay has been reached:
647653 // disable the delayed drag
648- on ( ownerDocument , 'mouseup' , _this . _disableDelayedDrag ) ;
649- on ( ownerDocument , 'touchend' , _this . _disableDelayedDrag ) ;
650- on ( ownerDocument , 'touchcancel' , _this . _disableDelayedDrag ) ;
654+ if ( options . supportPointer ) {
655+ on ( ownerDocument , 'pointerup' , _this . _disableDelayedDrag ) ;
656+ on ( ownerDocument , 'pointercancel' , _this . _disableDelayedDrag ) ;
657+ } else {
658+ on ( ownerDocument , 'mouseup' , _this . _disableDelayedDrag ) ;
659+ on ( ownerDocument , 'touchend' , _this . _disableDelayedDrag ) ;
660+ on ( ownerDocument , 'touchcancel' , _this . _disableDelayedDrag ) ;
661+ }
651662 on ( ownerDocument , 'mousemove' , _this . _delayedDragTouchMoveHandler ) ;
652663 on ( ownerDocument , 'touchmove' , _this . _delayedDragTouchMoveHandler ) ;
653664 options . supportPointer && on ( ownerDocument , 'pointermove' , _this . _delayedDragTouchMoveHandler ) ;
@@ -680,6 +691,8 @@ Sortable.prototype = /** @lends Sortable.prototype */ {
680691 off ( ownerDocument , 'mouseup' , this . _disableDelayedDrag ) ;
681692 off ( ownerDocument , 'touchend' , this . _disableDelayedDrag ) ;
682693 off ( ownerDocument , 'touchcancel' , this . _disableDelayedDrag ) ;
694+ off ( ownerDocument , 'pointerup' , this . _disableDelayedDrag ) ;
695+ off ( ownerDocument , 'pointercancel' , this . _disableDelayedDrag ) ;
683696 off ( ownerDocument , 'mousemove' , this . _delayedDragTouchMoveHandler ) ;
684697 off ( ownerDocument , 'touchmove' , this . _delayedDragTouchMoveHandler ) ;
685698 off ( ownerDocument , 'pointermove' , this . _delayedDragTouchMoveHandler ) ;
@@ -702,14 +715,13 @@ Sortable.prototype = /** @lends Sortable.prototype */ {
702715 }
703716
704717 try {
705- if ( document . selection ) {
706- // Timeout neccessary for IE9
707- _nextTick ( function ( ) {
718+ _nextTick ( function ( ) {
719+ if ( document . selection ) {
708720 document . selection . empty ( ) ;
709- } ) ;
710- } else {
711- window . getSelection ( ) . removeAllRanges ( ) ;
712- }
721+ } else {
722+ window . getSelection ( ) . removeAllRanges ( ) ;
723+ }
724+ } ) ;
713725 } catch ( err ) {
714726 }
715727 } ,
@@ -1333,6 +1345,7 @@ Sortable.prototype = /** @lends Sortable.prototype */ {
13331345 off ( ownerDocument , 'mouseup' , this . _onDrop ) ;
13341346 off ( ownerDocument , 'touchend' , this . _onDrop ) ;
13351347 off ( ownerDocument , 'pointerup' , this . _onDrop ) ;
1348+ off ( ownerDocument , 'pointercancel' , this . _onDrop ) ;
13361349 off ( ownerDocument , 'touchcancel' , this . _onDrop ) ;
13371350 off ( document , 'selectstart' , this ) ;
13381351 } ,
0 commit comments