11/**!
2- * Sortable 1.15.3
2+ * Sortable 1.15.4
33 * @author RubaXa <trash@rubaxa.org>
44 * @author owenm <owen23355@gmail.com>
55 * @license MIT
@@ -128,7 +128,7 @@ function _nonIterableSpread() {
128128 throw new TypeError ( "Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method." ) ;
129129}
130130
131- var version = "1.15.3 " ;
131+ var version = "1.15.4 " ;
132132
133133function userAgent ( pattern ) {
134134 if ( typeof window !== 'undefined' && window . navigator ) {
@@ -1232,7 +1232,7 @@ Sortable.prototype = /** @lends Sortable.prototype */{
12321232 pluginEvent ( 'filter' , _this , {
12331233 evt : evt
12341234 } ) ;
1235- preventOnFilter && evt . cancelable && evt . preventDefault ( ) ;
1235+ preventOnFilter && evt . preventDefault ( ) ;
12361236 return ; // cancel dnd
12371237 }
12381238 } else if ( filter ) {
@@ -1254,7 +1254,7 @@ Sortable.prototype = /** @lends Sortable.prototype */{
12541254 }
12551255 } ) ;
12561256 if ( filter ) {
1257- preventOnFilter && evt . cancelable && evt . preventDefault ( ) ;
1257+ preventOnFilter && evt . preventDefault ( ) ;
12581258 return ; // cancel dnd
12591259 }
12601260 }
@@ -1326,9 +1326,15 @@ Sortable.prototype = /** @lends Sortable.prototype */{
13261326 on ( ownerDocument , 'dragover' , nearestEmptyInsertDetectEvent ) ;
13271327 on ( ownerDocument , 'mousemove' , nearestEmptyInsertDetectEvent ) ;
13281328 on ( ownerDocument , 'touchmove' , nearestEmptyInsertDetectEvent ) ;
1329- on ( ownerDocument , 'mouseup' , _this . _onDrop ) ;
1330- on ( ownerDocument , 'touchend' , _this . _onDrop ) ;
1331- on ( ownerDocument , 'touchcancel' , _this . _onDrop ) ;
1329+ if ( options . supportPointer ) {
1330+ on ( ownerDocument , 'pointerup' , _this . _onDrop ) ;
1331+ // Native D&D triggers pointercancel
1332+ ! this . nativeDraggable && on ( ownerDocument , 'pointercancel' , _this . _onDrop ) ;
1333+ } else {
1334+ on ( ownerDocument , 'mouseup' , _this . _onDrop ) ;
1335+ on ( ownerDocument , 'touchend' , _this . _onDrop ) ;
1336+ on ( ownerDocument , 'touchcancel' , _this . _onDrop ) ;
1337+ }
13321338
13331339 // Make dragEl draggable (must be before delay for FireFox)
13341340 if ( FireFox && this . nativeDraggable ) {
@@ -1348,9 +1354,14 @@ Sortable.prototype = /** @lends Sortable.prototype */{
13481354 // If the user moves the pointer or let go the click or touch
13491355 // before the delay has been reached:
13501356 // disable the delayed drag
1351- on ( ownerDocument , 'mouseup' , _this . _disableDelayedDrag ) ;
1352- on ( ownerDocument , 'touchend' , _this . _disableDelayedDrag ) ;
1353- on ( ownerDocument , 'touchcancel' , _this . _disableDelayedDrag ) ;
1357+ if ( options . supportPointer ) {
1358+ on ( ownerDocument , 'pointerup' , _this . _disableDelayedDrag ) ;
1359+ on ( ownerDocument , 'pointercancel' , _this . _disableDelayedDrag ) ;
1360+ } else {
1361+ on ( ownerDocument , 'mouseup' , _this . _disableDelayedDrag ) ;
1362+ on ( ownerDocument , 'touchend' , _this . _disableDelayedDrag ) ;
1363+ on ( ownerDocument , 'touchcancel' , _this . _disableDelayedDrag ) ;
1364+ }
13541365 on ( ownerDocument , 'mousemove' , _this . _delayedDragTouchMoveHandler ) ;
13551366 on ( ownerDocument , 'touchmove' , _this . _delayedDragTouchMoveHandler ) ;
13561367 options . supportPointer && on ( ownerDocument , 'pointermove' , _this . _delayedDragTouchMoveHandler ) ;
@@ -1376,6 +1387,8 @@ Sortable.prototype = /** @lends Sortable.prototype */{
13761387 off ( ownerDocument , 'mouseup' , this . _disableDelayedDrag ) ;
13771388 off ( ownerDocument , 'touchend' , this . _disableDelayedDrag ) ;
13781389 off ( ownerDocument , 'touchcancel' , this . _disableDelayedDrag ) ;
1390+ off ( ownerDocument , 'pointerup' , this . _disableDelayedDrag ) ;
1391+ off ( ownerDocument , 'pointercancel' , this . _disableDelayedDrag ) ;
13791392 off ( ownerDocument , 'mousemove' , this . _delayedDragTouchMoveHandler ) ;
13801393 off ( ownerDocument , 'touchmove' , this . _delayedDragTouchMoveHandler ) ;
13811394 off ( ownerDocument , 'pointermove' , this . _delayedDragTouchMoveHandler ) ;
@@ -1395,14 +1408,13 @@ Sortable.prototype = /** @lends Sortable.prototype */{
13951408 on ( rootEl , 'dragstart' , this . _onDragStart ) ;
13961409 }
13971410 try {
1398- if ( document . selection ) {
1399- // Timeout neccessary for IE9
1400- _nextTick ( function ( ) {
1411+ _nextTick ( function ( ) {
1412+ if ( document . selection ) {
14011413 document . selection . empty ( ) ;
1402- } ) ;
1403- } else {
1404- window . getSelection ( ) . removeAllRanges ( ) ;
1405- }
1414+ } else {
1415+ window . getSelection ( ) . removeAllRanges ( ) ;
1416+ }
1417+ } ) ;
14061418 } catch ( err ) { }
14071419 } ,
14081420 _dragStarted : function _dragStarted ( fallback , evt ) {
@@ -1889,6 +1901,7 @@ Sortable.prototype = /** @lends Sortable.prototype */{
18891901 off ( ownerDocument , 'mouseup' , this . _onDrop ) ;
18901902 off ( ownerDocument , 'touchend' , this . _onDrop ) ;
18911903 off ( ownerDocument , 'pointerup' , this . _onDrop ) ;
1904+ off ( ownerDocument , 'pointercancel' , this . _onDrop ) ;
18921905 off ( ownerDocument , 'touchcancel' , this . _onDrop ) ;
18931906 off ( document , 'selectstart' , this ) ;
18941907 } ,
@@ -3079,28 +3092,38 @@ function MultiDragPlugin() {
30793092 var lastIndex = index ( lastMultiDragSelect ) ,
30803093 currentIndex = index ( dragEl$1 ) ;
30813094 if ( ~ lastIndex && ~ currentIndex && lastIndex !== currentIndex ) {
3082- // Must include lastMultiDragSelect (select it), in case modified selection from no selection
3083- // (but previous selection existed)
3084- var n , i ;
3085- if ( currentIndex > lastIndex ) {
3086- i = lastIndex ;
3087- n = currentIndex ;
3088- } else {
3089- i = currentIndex ;
3090- n = lastIndex + 1 ;
3091- }
3092- for ( ; i < n ; i ++ ) {
3093- if ( ~ multiDragElements . indexOf ( children [ i ] ) ) continue ;
3094- toggleClass ( children [ i ] , options . selectedClass , true ) ;
3095- multiDragElements . push ( children [ i ] ) ;
3096- dispatchEvent ( {
3097- sortable : sortable ,
3098- rootEl : rootEl ,
3099- name : 'select' ,
3100- targetEl : children [ i ] ,
3101- originalEvent : evt
3102- } ) ;
3103- }
3095+ ( function ( ) {
3096+ // Must include lastMultiDragSelect (select it), in case modified selection from no selection
3097+ // (but previous selection existed)
3098+ var n , i ;
3099+ if ( currentIndex > lastIndex ) {
3100+ i = lastIndex ;
3101+ n = currentIndex ;
3102+ } else {
3103+ i = currentIndex ;
3104+ n = lastIndex + 1 ;
3105+ }
3106+ var filter = options . filter ;
3107+ for ( ; i < n ; i ++ ) {
3108+ if ( ~ multiDragElements . indexOf ( children [ i ] ) ) continue ;
3109+ // Check if element is draggable
3110+ if ( ! closest ( children [ i ] , options . draggable , parentEl , false ) ) continue ;
3111+ // Check if element is filtered
3112+ var filtered = filter && ( typeof filter === 'function' ? filter . call ( sortable , evt , children [ i ] , sortable ) : filter . split ( ',' ) . some ( function ( criteria ) {
3113+ return closest ( children [ i ] , criteria . trim ( ) , parentEl , false ) ;
3114+ } ) ) ;
3115+ if ( filtered ) continue ;
3116+ toggleClass ( children [ i ] , options . selectedClass , true ) ;
3117+ multiDragElements . push ( children [ i ] ) ;
3118+ dispatchEvent ( {
3119+ sortable : sortable ,
3120+ rootEl : rootEl ,
3121+ name : 'select' ,
3122+ targetEl : children [ i ] ,
3123+ originalEvent : evt
3124+ } ) ;
3125+ }
3126+ } ) ( ) ;
31043127 }
31053128 } else {
31063129 lastMultiDragSelect = dragEl$1 ;
0 commit comments