From 3003909a974ff3d03c8326a70eaf5306ba02dd90 Mon Sep 17 00:00:00 2001 From: Artem Lipatov Date: Wed, 27 Jul 2016 18:07:39 +0300 Subject: [PATCH] Fix problem with supporting css pointer-event in IE11 #920 IE-11 supports css pointer-events incorrect: if your draggable elem contains pseudoelements, Sortable.js will solve that your draggable elem are dropping to itself. So Sortable.js will place your draggable elem to end of list. This PR let to Sortable.js solve that IE11 doesnt support pointer-events --- Sortable.js | 4 ++++ Sortable.min.js | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Sortable.js b/Sortable.js index 72a1618..142a7e9 100644 --- a/Sortable.js +++ b/Sortable.js @@ -72,6 +72,10 @@ supportDraggable = !!('draggable' in document.createElement('div')), supportCssPointerEvents = (function (el) { + // false when IE11 + if (!!navigator.userAgent.match(/Trident.*rv[ :]?11\./)) { + return false; + } el = document.createElement('x'); el.style.cssText = 'pointer-events:auto'; return el.style.pointerEvents === 'auto'; diff --git a/Sortable.min.js b/Sortable.min.js index 666c29b..991f43a 100644 --- a/Sortable.min.js +++ b/Sortable.min.js @@ -1,2 +1,2 @@ /*! Sortable 1.4.2 - MIT | git://github.com/rubaxa/Sortable.git */ -!function(a){"use strict";"function"==typeof define&&define.amd?define(a):"undefined"!=typeof module&&"undefined"!=typeof module.exports?module.exports=a():"undefined"!=typeof Package?Sortable=a():window.Sortable=a()}(function(){"use strict";function a(a,b){if(!a||!a.nodeType||1!==a.nodeType)throw"Sortable: `el` must be HTMLElement, and not "+{}.toString.call(a);this.el=a,this.options=b=s({},b),a[P]=this;var c={group:Math.random(),sort:!0,disabled:!1,store:null,handle:null,scroll:!0,scrollSensitivity:30,scrollSpeed:10,draggable:/[uo]l/i.test(a.nodeName)?"li":">*",ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,animation:0,setData:function(a,b){a.setData("Text",b.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0}};for(var d in c)!(d in b)&&(b[d]=c[d]);aa(b);for(var f in this)"_"===f.charAt(0)&&"function"==typeof this[f]&&(this[f]=this[f].bind(this));this.nativeDraggable=b.forceFallback?!1:V,e(a,"mousedown",this._onTapStart),e(a,"touchstart",this._onTapStart),this.nativeDraggable&&(e(a,"dragover",this),e(a,"dragenter",this)),$.push(this._onDragOver),b.store&&this.sort(b.store.get(this))}function b(a){x&&x.state!==a&&(h(x,"display",a?"none":""),!a&&x.state&&y.insertBefore(x,u),x.state=a)}function c(a,b,c){if(a){c=c||R;do if(">*"===b&&a.parentNode===c||q(a,b))return a;while(a!==c&&(a=a.parentNode))}return null}function d(a){a.dataTransfer&&(a.dataTransfer.dropEffect="move"),a.preventDefault()}function e(a,b,c){a.addEventListener(b,c,!1)}function f(a,b,c){a.removeEventListener(b,c,!1)}function g(a,b,c){if(a)if(a.classList)a.classList[c?"add":"remove"](b);else{var d=(" "+a.className+" ").replace(O," ").replace(" "+b+" "," ");a.className=(d+(c?" "+b:"")).replace(O," ")}}function h(a,b,c){var d=a&&a.style;if(d){if(void 0===c)return R.defaultView&&R.defaultView.getComputedStyle?c=R.defaultView.getComputedStyle(a,""):a.currentStyle&&(c=a.currentStyle),void 0===b?c:c[b];b in d||(b="-webkit-"+b),d[b]=c+("string"==typeof c?"":"px")}}function i(a,b,c){if(a){var d=a.getElementsByTagName(b),e=0,f=d.length;if(c)for(;f>e;e++)c(d[e],e);return d}return[]}function j(a,b,c,d,e,f,g){a=a||b[P];var h=R.createEvent("Event"),i=a.options,j="on"+c.charAt(0).toUpperCase()+c.substr(1);h.initEvent(c,!0,!0),h.to=b,h.from=e||b,h.item=d||b,h.clone=x,h.oldIndex=f,h.newIndex=g,b.dispatchEvent(h),i[j]&&i[j].call(a,h)}function k(a,b,c,d,e,f,g){var h,i,j=a[P],k=j.options.onMove;return h=R.createEvent("Event"),h.initEvent("move",!0,!0),h.to=b,h.from=a,h.dragged=c,h.draggedRect=d,h.related=e||b,h.relatedRect=f||b.getBoundingClientRect(),a.dispatchEvent(h),k&&(i=k.call(j,h,g)),i}function l(a){a.draggable=!1}function m(){X=!1}function n(a,b){var c=a.lastElementChild,d=c.getBoundingClientRect();return(b.clientY-(d.top+d.height)>5||b.clientX-(d.right+d.width)>5)&&c}function o(a){for(var b=a.tagName+a.className+a.src+a.href+a.textContent,c=b.length,d=0;c--;)d+=b.charCodeAt(c);return d.toString(36)}function p(a,b){var c=0;if(!a||!a.parentNode)return-1;for(;a&&(a=a.previousElementSibling);)"TEMPLATE"===a.nodeName.toUpperCase()||">*"!==b&&!q(a,b)||c++;return c}function q(a,b){if(a){b=b.split(".");var c=b.shift().toUpperCase(),d=new RegExp("\\s("+b.join("|")+")(?=\\s)","g");return!(""!==c&&a.nodeName.toUpperCase()!=c||b.length&&((" "+a.className+" ").match(d)||[]).length!=b.length)}return!1}function r(a,b){var c,d;return function(){void 0===c&&(c=arguments,d=this,setTimeout(function(){1===c.length?a.call(d,c[0]):a.apply(d,c),c=void 0},b))}}function s(a,b){if(a&&b)for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);return a}function t(a){return T?T(a).clone(!0)[0]:U&&U.dom?U.dom(a).cloneNode(!0):a.cloneNode(!0)}if("undefined"==typeof window||!window.document)return function(){throw new Error("Sortable.js requires a window with a document")};var u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N={},O=/\s+/g,P="Sortable"+(new Date).getTime(),Q=window,R=Q.document,S=Q.parseInt,T=Q.jQuery||Q.Zepto,U=Q.Polymer,V=!!("draggable"in R.createElement("div")),W=function(a){return a=R.createElement("x"),a.style.cssText="pointer-events:auto","auto"===a.style.pointerEvents}(),X=!1,Y=Math.abs,Z=Math.min,$=([].slice,[]),_=r(function(a,b,c){if(c&&b.scroll){var d,e,f,g,h,i,j=b.scrollSensitivity,k=b.scrollSpeed,l=a.clientX,m=a.clientY,n=window.innerWidth,o=window.innerHeight;if(B!==c&&(A=b.scroll,B=c,C=b.scrollFn,A===!0)){A=c;do if(A.offsetWidth=n-l)-(j>=l),g=(j>=o-m)-(j>=m),(f||g)&&(d=Q)),(N.vx!==f||N.vy!==g||N.el!==d)&&(N.el=d,N.vx=f,N.vy=g,clearInterval(N.pid),d&&(N.pid=setInterval(function(){return i=g?g*k:0,h=f?f*k:0,"function"==typeof C?C.call(_this,h,i,a):void(d===Q?Q.scrollTo(Q.pageXOffset+h,Q.pageYOffset+i):(d.scrollTop+=i,d.scrollLeft+=h))},24)))}},30),aa=function(a){function b(a,b){return(void 0===a||a===!0)&&(a=c.name),"function"==typeof a?a:function(c,d){var e=d.options.group.name;return b?a:a&&(a.join?a.indexOf(e)>-1:e==a)}}var c={},d=a.group;d&&"object"==typeof d||(d={name:d}),c.name=d.name,c.checkPull=b(d.pull,!0),c.checkPut=b(d.put),a.group=c};return a.prototype={constructor:a,_onTapStart:function(a){var b,d=this,e=this.el,f=this.options,g=a.type,h=a.touches&&a.touches[0],i=(h||a).target,k=i,l=f.filter;if(!u&&!("mousedown"===g&&0!==a.button||f.disabled)&&(i=c(i,f.draggable,e),i&&(!f.handle||c(k,f.handle,e)))){if(b=p(i,f.draggable),"function"==typeof l){if(l.call(this,a,i,this))return j(d,k,"filter",i,e,b),void a.preventDefault()}else if(l&&(l=l.split(",").some(function(a){return a=c(k,a.trim(),e),a?(j(d,a,"filter",i,e,b),!0):void 0})))return void a.preventDefault();this._prepareDragStart(a,h,i,b)}},_prepareDragStart:function(a,b,c,d){var f,h=this,k=h.el,m=h.options,n=k.ownerDocument;c&&!u&&c.parentNode===k&&(K=a,y=k,u=c,v=u.parentNode,z=u.nextSibling,I=m.group,G=d,this._lastX=(b||a).clientX,this._lastY=(b||a).clientY,u.style["will-change"]="transform",f=function(){h._disableDelayedDrag(),u.draggable=h.nativeDraggable,g(u,m.chosenClass,!0),h._triggerDragStart(b),j(h,y,"choose",u,y,G)},m.ignore.split(",").forEach(function(a){i(u,a.trim(),l)}),e(n,"mouseup",h._onDrop),e(n,"touchend",h._onDrop),e(n,"touchcancel",h._onDrop),m.delay?(e(n,"mouseup",h._disableDelayedDrag),e(n,"touchend",h._disableDelayedDrag),e(n,"touchcancel",h._disableDelayedDrag),e(n,"mousemove",h._disableDelayedDrag),e(n,"touchmove",h._disableDelayedDrag),h._dragStartTimer=setTimeout(f,m.delay)):f())},_disableDelayedDrag:function(){var a=this.el.ownerDocument;clearTimeout(this._dragStartTimer),f(a,"mouseup",this._disableDelayedDrag),f(a,"touchend",this._disableDelayedDrag),f(a,"touchcancel",this._disableDelayedDrag),f(a,"mousemove",this._disableDelayedDrag),f(a,"touchmove",this._disableDelayedDrag)},_triggerDragStart:function(a){a?(K={target:u,clientX:a.clientX,clientY:a.clientY},this._onDragStart(K,"touch")):this.nativeDraggable?(e(u,"dragend",this),e(y,"dragstart",this._onDragStart)):this._onDragStart(K,!0);try{R.selection?setTimeout(function(){R.selection.empty()}):window.getSelection().removeAllRanges()}catch(b){}},_dragStarted:function(){if(y&&u){var b=this.options;g(u,b.ghostClass,!0),g(u,b.dragClass,!1),a.active=this,j(this,y,"start",u,y,G)}},_emulateDragOver:function(){if(L){if(this._lastX===L.clientX&&this._lastY===L.clientY)return;this._lastX=L.clientX,this._lastY=L.clientY,W||h(w,"display","none");var a=R.elementFromPoint(L.clientX,L.clientY),b=a,c=$.length;if(b)do{if(b[P]){for(;c--;)$[c]({clientX:L.clientX,clientY:L.clientY,target:a,rootEl:b});break}a=b}while(b=b.parentNode);W||h(w,"display","")}},_onTouchMove:function(b){if(K){var c=this.options,d=c.fallbackTolerance,e=c.fallbackOffset,f=b.touches?b.touches[0]:b,g=f.clientX-K.clientX+e.x,i=f.clientY-K.clientY+e.y,j=b.touches?"translate3d("+g+"px,"+i+"px,0)":"translate("+g+"px,"+i+"px)";if(!a.active){if(d&&Z(Y(f.clientX-this._lastX),Y(f.clientY-this._lastY))u.offsetWidth,G=e.offsetHeight>u.offsetHeight,H=(B?(d.clientX-s.left)/t:(d.clientY-s.top)/A)>.5,K=e.nextElementSibling,L=k(y,i,u,f,e,s,d);if(L!==!1){if(X=!0,setTimeout(m,30),b(p),1===L||-1===L)r=1===L;else if(B){var N=u.offsetTop,O=e.offsetTop;r=N===O?e.previousElementSibling===u&&!C||H&&C:e.previousElementSibling===u||u.previousElementSibling===e?(d.clientY-s.top)/A>.5:O>N}else r=K!==u&&!G||H&&G;u.contains(i)||(r&&!K?i.appendChild(u):e.parentNode.insertBefore(u,r?K:e)),v=u.parentNode,this._animate(f,u),this._animate(s,e)}}}},_animate:function(a,b){var c=this.options.animation;if(c){var d=b.getBoundingClientRect();h(b,"transition","none"),h(b,"transform","translate3d("+(a.left-d.left)+"px,"+(a.top-d.top)+"px,0)"),b.offsetWidth,h(b,"transition","all "+c+"ms"),h(b,"transform","translate3d(0,0,0)"),clearTimeout(b.animated),b.animated=setTimeout(function(){h(b,"transition",""),h(b,"transform",""),b.animated=!1},c)}},_offUpEvents:function(){var a=this.el.ownerDocument;f(R,"touchmove",this._onTouchMove),f(a,"mouseup",this._onDrop),f(a,"touchend",this._onDrop),f(a,"touchcancel",this._onDrop)},_onDrop:function(b){var c=this.el,d=this.options;clearInterval(this._loopId),clearInterval(N.pid),clearTimeout(this._dragStartTimer),f(R,"mousemove",this._onTouchMove),this.nativeDraggable&&(f(R,"drop",this),f(c,"dragstart",this._onDragStart)),this._offUpEvents(),b&&(M&&(b.preventDefault(),!d.dropBubble&&b.stopPropagation()),w&&w.parentNode.removeChild(w),u&&(this.nativeDraggable&&f(u,"dragend",this),l(u),u.style["will-change"]="",g(u,this.options.ghostClass,!1),g(u,this.options.chosenClass,!1),y!==v?(H=p(u,d.draggable),H>=0&&(j(null,v,"add",u,y,G,H),j(this,y,"remove",u,y,G,H),j(null,v,"sort",u,y,G,H),j(this,y,"sort",u,y,G,H))):(x&&x.parentNode.removeChild(x),u.nextSibling!==z&&(H=p(u,d.draggable),H>=0&&(j(this,y,"update",u,y,G,H),j(this,y,"sort",u,y,G,H)))),a.active&&((null==H||-1===H)&&(H=G),j(this,y,"end",u,y,G,H),this.save()))),this._nulling()},_nulling:function(){y=u=v=w=z=x=A=B=K=L=M=H=D=E=J=I=a.active=null},handleEvent:function(a){var b=a.type;"dragover"===b||"dragenter"===b?u&&(this._onDragOver(a),d(a)):("drop"===b||"dragend"===b)&&this._onDrop(a)},toArray:function(){for(var a,b=[],d=this.el.children,e=0,f=d.length,g=this.options;f>e;e++)a=d[e],c(a,g.draggable,this.el)&&b.push(a.getAttribute(g.dataIdAttr)||o(a));return b},sort:function(a){var b={},d=this.el;this.toArray().forEach(function(a,e){var f=d.children[e];c(f,this.options.draggable,d)&&(b[a]=f)},this),a.forEach(function(a){b[a]&&(d.removeChild(b[a]),d.appendChild(b[a]))})},save:function(){var a=this.options.store;a&&a.set(this)},closest:function(a,b){return c(a,b||this.options.draggable,this.el)},option:function(a,b){var c=this.options;return void 0===b?c[a]:(c[a]=b,void("group"===a&&aa(c)))},destroy:function(){var a=this.el;a[P]=null,f(a,"mousedown",this._onTapStart),f(a,"touchstart",this._onTapStart),this.nativeDraggable&&(f(a,"dragover",this),f(a,"dragenter",this)),Array.prototype.forEach.call(a.querySelectorAll("[draggable]"),function(a){a.removeAttribute("draggable")}),$.splice($.indexOf(this._onDragOver),1),this._onDrop(),this.el=a=null}},a.utils={on:e,off:f,css:h,find:i,is:function(a,b){return!!c(a,b,a)},extend:s,throttle:r,closest:c,toggleClass:g,clone:t,index:p},a.create=function(b,c){return new a(b,c)},a.version="1.4.2",a}); \ No newline at end of file +!function(a){"use strict";"function"==typeof define&&define.amd?define(a):"undefined"!=typeof module&&"undefined"!=typeof module.exports?module.exports=a():"undefined"!=typeof Package?Sortable=a():window.Sortable=a()}(function(){"use strict";function a(a,b){if(!a||!a.nodeType||1!==a.nodeType)throw"Sortable: `el` must be HTMLElement, and not "+{}.toString.call(a);this.el=a,this.options=b=s({},b),a[P]=this;var c={group:Math.random(),sort:!0,disabled:!1,store:null,handle:null,scroll:!0,scrollSensitivity:30,scrollSpeed:10,draggable:/[uo]l/i.test(a.nodeName)?"li":">*",ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,animation:0,setData:function(a,b){a.setData("Text",b.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0}};for(var d in c)!(d in b)&&(b[d]=c[d]);aa(b);for(var f in this)"_"===f.charAt(0)&&"function"==typeof this[f]&&(this[f]=this[f].bind(this));this.nativeDraggable=!b.forceFallback&&V,e(a,"mousedown",this._onTapStart),e(a,"touchstart",this._onTapStart),this.nativeDraggable&&(e(a,"dragover",this),e(a,"dragenter",this)),$.push(this._onDragOver),b.store&&this.sort(b.store.get(this))}function b(a){x&&x.state!==a&&(h(x,"display",a?"none":""),!a&&x.state&&y.insertBefore(x,u),x.state=a)}function c(a,b,c){if(a){c=c||R;do if(">*"===b&&a.parentNode===c||q(a,b))return a;while(a!==c&&(a=a.parentNode))}return null}function d(a){a.dataTransfer&&(a.dataTransfer.dropEffect="move"),a.preventDefault()}function e(a,b,c){a.addEventListener(b,c,!1)}function f(a,b,c){a.removeEventListener(b,c,!1)}function g(a,b,c){if(a)if(a.classList)a.classList[c?"add":"remove"](b);else{var d=(" "+a.className+" ").replace(O," ").replace(" "+b+" "," ");a.className=(d+(c?" "+b:"")).replace(O," ")}}function h(a,b,c){var d=a&&a.style;if(d){if(void 0===c)return R.defaultView&&R.defaultView.getComputedStyle?c=R.defaultView.getComputedStyle(a,""):a.currentStyle&&(c=a.currentStyle),void 0===b?c:c[b];b in d||(b="-webkit-"+b),d[b]=c+("string"==typeof c?"":"px")}}function i(a,b,c){if(a){var d=a.getElementsByTagName(b),e=0,f=d.length;if(c)for(;e5||b.clientX-(d.right+d.width)>5)&&c}function o(a){for(var b=a.tagName+a.className+a.src+a.href+a.textContent,c=b.length,d=0;c--;)d+=b.charCodeAt(c);return d.toString(36)}function p(a,b){var c=0;if(!a||!a.parentNode)return-1;for(;a&&(a=a.previousElementSibling);)"TEMPLATE"===a.nodeName.toUpperCase()||">*"!==b&&!q(a,b)||c++;return c}function q(a,b){if(a){b=b.split(".");var c=b.shift().toUpperCase(),d=new RegExp("\\s("+b.join("|")+")(?=\\s)","g");return!(""!==c&&a.nodeName.toUpperCase()!=c||b.length&&((" "+a.className+" ").match(d)||[]).length!=b.length)}return!1}function r(a,b){var c,d;return function(){void 0===c&&(c=arguments,d=this,setTimeout(function(){1===c.length?a.call(d,c[0]):a.apply(d,c),c=void 0},b))}}function s(a,b){if(a&&b)for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);return a}function t(a){return T?T(a).clone(!0)[0]:U&&U.dom?U.dom(a).cloneNode(!0):a.cloneNode(!0)}if("undefined"==typeof window||!window.document)return function(){throw new Error("Sortable.js requires a window with a document")};var u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N={},O=/\s+/g,P="Sortable"+(new Date).getTime(),Q=window,R=Q.document,S=Q.parseInt,T=Q.jQuery||Q.Zepto,U=Q.Polymer,V=!!("draggable"in R.createElement("div")),W=function(a){return!navigator.userAgent.match(/Trident.*rv[ :]?11\./)&&(a=R.createElement("x"),a.style.cssText="pointer-events:auto","auto"===a.style.pointerEvents)}(),X=!1,Y=Math.abs,Z=Math.min,$=([].slice,[]),_=r(function(a,b,c){if(c&&b.scroll){var d,e,f,g,h,i,j=b.scrollSensitivity,k=b.scrollSpeed,l=a.clientX,m=a.clientY,n=window.innerWidth,o=window.innerHeight;if(B!==c&&(A=b.scroll,B=c,C=b.scrollFn,A===!0)){A=c;do if(A.offsetWidth-1:e==a)}}var c={},d=a.group;d&&"object"==typeof d||(d={name:d}),c.name=d.name,c.checkPull=b(d.pull,!0),c.checkPut=b(d.put),a.group=c};return a.prototype={constructor:a,_onTapStart:function(a){var b,d=this,e=this.el,f=this.options,g=a.type,h=a.touches&&a.touches[0],i=(h||a).target,k=i,l=f.filter;if(!u&&!("mousedown"===g&&0!==a.button||f.disabled)&&(i=c(i,f.draggable,e),i&&(!f.handle||c(k,f.handle,e)))){if(b=p(i,f.draggable),"function"==typeof l){if(l.call(this,a,i,this))return j(d,k,"filter",i,e,b),void a.preventDefault()}else if(l&&(l=l.split(",").some(function(a){if(a=c(k,a.trim(),e))return j(d,a,"filter",i,e,b),!0})))return void a.preventDefault();this._prepareDragStart(a,h,i,b)}},_prepareDragStart:function(a,b,c,d){var f,h=this,k=h.el,m=h.options,n=k.ownerDocument;c&&!u&&c.parentNode===k&&(K=a,y=k,u=c,v=u.parentNode,z=u.nextSibling,I=m.group,G=d,this._lastX=(b||a).clientX,this._lastY=(b||a).clientY,u.style["will-change"]="transform",f=function(){h._disableDelayedDrag(),u.draggable=h.nativeDraggable,g(u,m.chosenClass,!0),h._triggerDragStart(b),j(h,y,"choose",u,y,G)},m.ignore.split(",").forEach(function(a){i(u,a.trim(),l)}),e(n,"mouseup",h._onDrop),e(n,"touchend",h._onDrop),e(n,"touchcancel",h._onDrop),m.delay?(e(n,"mouseup",h._disableDelayedDrag),e(n,"touchend",h._disableDelayedDrag),e(n,"touchcancel",h._disableDelayedDrag),e(n,"mousemove",h._disableDelayedDrag),e(n,"touchmove",h._disableDelayedDrag),h._dragStartTimer=setTimeout(f,m.delay)):f())},_disableDelayedDrag:function(){var a=this.el.ownerDocument;clearTimeout(this._dragStartTimer),f(a,"mouseup",this._disableDelayedDrag),f(a,"touchend",this._disableDelayedDrag),f(a,"touchcancel",this._disableDelayedDrag),f(a,"mousemove",this._disableDelayedDrag),f(a,"touchmove",this._disableDelayedDrag)},_triggerDragStart:function(a){a?(K={target:u,clientX:a.clientX,clientY:a.clientY},this._onDragStart(K,"touch")):this.nativeDraggable?(e(u,"dragend",this),e(y,"dragstart",this._onDragStart)):this._onDragStart(K,!0);try{R.selection?setTimeout(function(){R.selection.empty()}):window.getSelection().removeAllRanges()}catch(a){}},_dragStarted:function(){if(y&&u){var b=this.options;g(u,b.ghostClass,!0),g(u,b.dragClass,!1),a.active=this,j(this,y,"start",u,y,G)}},_emulateDragOver:function(){if(L){if(this._lastX===L.clientX&&this._lastY===L.clientY)return;this._lastX=L.clientX,this._lastY=L.clientY,W||h(w,"display","none");var a=R.elementFromPoint(L.clientX,L.clientY),b=a,c=$.length;if(b)do{if(b[P]){for(;c--;)$[c]({clientX:L.clientX,clientY:L.clientY,target:a,rootEl:b});break}a=b}while(b=b.parentNode);W||h(w,"display","")}},_onTouchMove:function(b){if(K){var c=this.options,d=c.fallbackTolerance,e=c.fallbackOffset,f=b.touches?b.touches[0]:b,g=f.clientX-K.clientX+e.x,i=f.clientY-K.clientY+e.y,j=b.touches?"translate3d("+g+"px,"+i+"px,0)":"translate("+g+"px,"+i+"px)";if(!a.active){if(d&&Z(Y(f.clientX-this._lastX),Y(f.clientY-this._lastY))u.offsetWidth,G=e.offsetHeight>u.offsetHeight,H=(B?(d.clientX-s.left)/t:(d.clientY-s.top)/A)>.5,K=e.nextElementSibling,L=k(y,i,u,f,e,s,d);if(L!==!1){if(X=!0,setTimeout(m,30),b(p),1===L||L===-1)r=1===L;else if(B){var N=u.offsetTop,O=e.offsetTop;r=N===O?e.previousElementSibling===u&&!C||H&&C:e.previousElementSibling===u||u.previousElementSibling===e?(d.clientY-s.top)/A>.5:O>N}else r=K!==u&&!G||H&&G;u.contains(i)||(r&&!K?i.appendChild(u):e.parentNode.insertBefore(u,r?K:e)),v=u.parentNode,this._animate(f,u),this._animate(s,e)}}}},_animate:function(a,b){var c=this.options.animation;if(c){var d=b.getBoundingClientRect();h(b,"transition","none"),h(b,"transform","translate3d("+(a.left-d.left)+"px,"+(a.top-d.top)+"px,0)"),b.offsetWidth,h(b,"transition","all "+c+"ms"),h(b,"transform","translate3d(0,0,0)"),clearTimeout(b.animated),b.animated=setTimeout(function(){h(b,"transition",""),h(b,"transform",""),b.animated=!1},c)}},_offUpEvents:function(){var a=this.el.ownerDocument;f(R,"touchmove",this._onTouchMove),f(a,"mouseup",this._onDrop),f(a,"touchend",this._onDrop),f(a,"touchcancel",this._onDrop)},_onDrop:function(b){var c=this.el,d=this.options;clearInterval(this._loopId),clearInterval(N.pid),clearTimeout(this._dragStartTimer),f(R,"mousemove",this._onTouchMove),this.nativeDraggable&&(f(R,"drop",this),f(c,"dragstart",this._onDragStart)),this._offUpEvents(),b&&(M&&(b.preventDefault(),!d.dropBubble&&b.stopPropagation()),w&&w.parentNode.removeChild(w),u&&(this.nativeDraggable&&f(u,"dragend",this),l(u),u.style["will-change"]="",g(u,this.options.ghostClass,!1),g(u,this.options.chosenClass,!1),y!==v?(H=p(u,d.draggable),H>=0&&(j(null,v,"add",u,y,G,H),j(this,y,"remove",u,y,G,H),j(null,v,"sort",u,y,G,H),j(this,y,"sort",u,y,G,H))):(x&&x.parentNode.removeChild(x),u.nextSibling!==z&&(H=p(u,d.draggable),H>=0&&(j(this,y,"update",u,y,G,H),j(this,y,"sort",u,y,G,H)))),a.active&&(null!=H&&H!==-1||(H=G),j(this,y,"end",u,y,G,H),this.save()))),this._nulling()},_nulling:function(){y=u=v=w=z=x=A=B=K=L=M=H=D=E=J=I=a.active=null},handleEvent:function(a){var b=a.type;"dragover"===b||"dragenter"===b?u&&(this._onDragOver(a),d(a)):"drop"!==b&&"dragend"!==b||this._onDrop(a)},toArray:function(){for(var a,b=[],d=this.el.children,e=0,f=d.length,g=this.options;e