Skip to content

Commit 8a987c0

Browse files
committed
1.13.0
1 parent 5afb802 commit 8a987c0

6 files changed

+79
-31
lines changed

Sortable.js

+19-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**!
2-
* Sortable 1.10.2
2+
* Sortable 1.13.0
33
* @author RubaXa <[email protected]>
44
* @author owenm <[email protected]>
55
* @license MIT
@@ -132,7 +132,7 @@
132132
throw new TypeError("Invalid attempt to spread non-iterable instance");
133133
}
134134

135-
var version = "1.10.2";
135+
var version = "1.13.0";
136136

137137
function userAgent(pattern) {
138138
if (typeof window !== 'undefined' && window.navigator) {
@@ -314,7 +314,7 @@
314314
if (!el.getBoundingClientRect && el !== window) return;
315315
var elRect, top, left, bottom, right, height, width;
316316

317-
if (el !== window && el !== getWindowScrollingElement()) {
317+
if (el !== window && el.parentNode && el !== getWindowScrollingElement()) {
318318
elRect = el.getBoundingClientRect();
319319
top = elRect.top;
320320
left = elRect.left;
@@ -754,7 +754,7 @@
754754
target.animatingX = !!translateX;
755755
target.animatingY = !!translateY;
756756
css(target, 'transform', 'translate3d(' + translateX + 'px,' + translateY + 'px,0)');
757-
repaint(target); // repaint
757+
this.forRepaintDummy = repaint(target); // repaint
758758

759759
css(target, 'transition', 'transform ' + duration + 'ms' + (this.options.easing ? ' ' + this.options.easing : ''));
760760
css(target, 'transform', 'translate3d(0,0,0)');
@@ -792,6 +792,11 @@
792792
}
793793
}
794794

795+
plugins.forEach(function (p) {
796+
if (p.pluginName === plugin.pluginName) {
797+
throw "Sortable: Cannot mount plugin ".concat(plugin.pluginName, " more than once");
798+
}
799+
});
795800
plugins.push(plugin);
796801
},
797802
pluginEvent: function pluginEvent(eventName, sortable, evt) {
@@ -1235,7 +1240,7 @@
12351240
x: 0,
12361241
y: 0
12371242
},
1238-
supportPointer: Sortable.supportPointer !== false && 'PointerEvent' in window,
1243+
supportPointer: Sortable.supportPointer !== false && 'PointerEvent' in window && !Safari,
12391244
emptyInsertThreshold: 5
12401245
};
12411246
PluginManager.initializePlugins(this, el, defaults); // Set default options
@@ -1322,6 +1327,11 @@
13221327

13231328
if (originalTarget.isContentEditable) {
13241329
return;
1330+
} // Safari ignores further event handling after mousedown
1331+
1332+
1333+
if (!this.nativeDraggable && Safari && target && target.tagName.toUpperCase() === 'SELECT') {
1334+
return;
13251335
}
13261336

13271337
target = closest(target, options.draggable, el, false);
@@ -2319,7 +2329,7 @@
23192329
* Sorts the elements according to the array.
23202330
* @param {String[]} order order of the items
23212331
*/
2322-
sort: function sort(order) {
2332+
sort: function sort(order, useAnimation) {
23232333
var items = {},
23242334
rootEl = this.el;
23252335
this.toArray().forEach(function (id, i) {
@@ -2329,12 +2339,14 @@
23292339
items[id] = el;
23302340
}
23312341
}, this);
2342+
useAnimation && this.captureAnimationState();
23322343
order.forEach(function (id) {
23332344
if (items[id]) {
23342345
rootEl.removeChild(items[id]);
23352346
rootEl.appendChild(items[id]);
23362347
}
23372348
});
2349+
useAnimation && this.animateAll();
23382350
},
23392351

23402352
/**
@@ -2433,7 +2445,7 @@
24332445
pluginEvent('showClone', this);
24342446
if (Sortable.eventCanceled) return; // show clone at dragEl or original position
24352447

2436-
if (rootEl.contains(dragEl) && !this.options.group.revertClone) {
2448+
if (dragEl.parentNode == rootEl && !this.options.group.revertClone) {
24372449
rootEl.insertBefore(cloneEl, dragEl);
24382450
} else if (nextEl) {
24392451
rootEl.insertBefore(cloneEl, nextEl);

Sortable.min.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

modular/sortable.complete.esm.js

+19-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**!
2-
* Sortable 1.10.2
2+
* Sortable 1.13.0
33
* @author RubaXa <[email protected]>
44
* @author owenm <[email protected]>
55
* @license MIT
@@ -126,7 +126,7 @@ function _nonIterableSpread() {
126126
throw new TypeError("Invalid attempt to spread non-iterable instance");
127127
}
128128

129-
var version = "1.10.2";
129+
var version = "1.13.0";
130130

131131
function userAgent(pattern) {
132132
if (typeof window !== 'undefined' && window.navigator) {
@@ -308,7 +308,7 @@ function getRect(el, relativeToContainingBlock, relativeToNonStaticParent, undoS
308308
if (!el.getBoundingClientRect && el !== window) return;
309309
var elRect, top, left, bottom, right, height, width;
310310

311-
if (el !== window && el !== getWindowScrollingElement()) {
311+
if (el !== window && el.parentNode && el !== getWindowScrollingElement()) {
312312
elRect = el.getBoundingClientRect();
313313
top = elRect.top;
314314
left = elRect.left;
@@ -748,7 +748,7 @@ function AnimationStateManager() {
748748
target.animatingX = !!translateX;
749749
target.animatingY = !!translateY;
750750
css(target, 'transform', 'translate3d(' + translateX + 'px,' + translateY + 'px,0)');
751-
repaint(target); // repaint
751+
this.forRepaintDummy = repaint(target); // repaint
752752

753753
css(target, 'transition', 'transform ' + duration + 'ms' + (this.options.easing ? ' ' + this.options.easing : ''));
754754
css(target, 'transform', 'translate3d(0,0,0)');
@@ -786,6 +786,11 @@ var PluginManager = {
786786
}
787787
}
788788

789+
plugins.forEach(function (p) {
790+
if (p.pluginName === plugin.pluginName) {
791+
throw "Sortable: Cannot mount plugin ".concat(plugin.pluginName, " more than once");
792+
}
793+
});
789794
plugins.push(plugin);
790795
},
791796
pluginEvent: function pluginEvent(eventName, sortable, evt) {
@@ -1229,7 +1234,7 @@ function Sortable(el, options) {
12291234
x: 0,
12301235
y: 0
12311236
},
1232-
supportPointer: Sortable.supportPointer !== false && 'PointerEvent' in window,
1237+
supportPointer: Sortable.supportPointer !== false && 'PointerEvent' in window && !Safari,
12331238
emptyInsertThreshold: 5
12341239
};
12351240
PluginManager.initializePlugins(this, el, defaults); // Set default options
@@ -1316,6 +1321,11 @@ Sortable.prototype =
13161321

13171322
if (originalTarget.isContentEditable) {
13181323
return;
1324+
} // Safari ignores further event handling after mousedown
1325+
1326+
1327+
if (!this.nativeDraggable && Safari && target && target.tagName.toUpperCase() === 'SELECT') {
1328+
return;
13191329
}
13201330

13211331
target = closest(target, options.draggable, el, false);
@@ -2313,7 +2323,7 @@ Sortable.prototype =
23132323
* Sorts the elements according to the array.
23142324
* @param {String[]} order order of the items
23152325
*/
2316-
sort: function sort(order) {
2326+
sort: function sort(order, useAnimation) {
23172327
var items = {},
23182328
rootEl = this.el;
23192329
this.toArray().forEach(function (id, i) {
@@ -2323,12 +2333,14 @@ Sortable.prototype =
23232333
items[id] = el;
23242334
}
23252335
}, this);
2336+
useAnimation && this.captureAnimationState();
23262337
order.forEach(function (id) {
23272338
if (items[id]) {
23282339
rootEl.removeChild(items[id]);
23292340
rootEl.appendChild(items[id]);
23302341
}
23312342
});
2343+
useAnimation && this.animateAll();
23322344
},
23332345

23342346
/**
@@ -2427,7 +2439,7 @@ Sortable.prototype =
24272439
pluginEvent('showClone', this);
24282440
if (Sortable.eventCanceled) return; // show clone at dragEl or original position
24292441

2430-
if (rootEl.contains(dragEl) && !this.options.group.revertClone) {
2442+
if (dragEl.parentNode == rootEl && !this.options.group.revertClone) {
24312443
rootEl.insertBefore(cloneEl, dragEl);
24322444
} else if (nextEl) {
24332445
rootEl.insertBefore(cloneEl, nextEl);

modular/sortable.core.esm.js

+19-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**!
2-
* Sortable 1.10.2
2+
* Sortable 1.13.0
33
* @author RubaXa <[email protected]>
44
* @author owenm <[email protected]>
55
* @license MIT
@@ -126,7 +126,7 @@ function _nonIterableSpread() {
126126
throw new TypeError("Invalid attempt to spread non-iterable instance");
127127
}
128128

129-
var version = "1.10.2";
129+
var version = "1.13.0";
130130

131131
function userAgent(pattern) {
132132
if (typeof window !== 'undefined' && window.navigator) {
@@ -308,7 +308,7 @@ function getRect(el, relativeToContainingBlock, relativeToNonStaticParent, undoS
308308
if (!el.getBoundingClientRect && el !== window) return;
309309
var elRect, top, left, bottom, right, height, width;
310310

311-
if (el !== window && el !== getWindowScrollingElement()) {
311+
if (el !== window && el.parentNode && el !== getWindowScrollingElement()) {
312312
elRect = el.getBoundingClientRect();
313313
top = elRect.top;
314314
left = elRect.left;
@@ -748,7 +748,7 @@ function AnimationStateManager() {
748748
target.animatingX = !!translateX;
749749
target.animatingY = !!translateY;
750750
css(target, 'transform', 'translate3d(' + translateX + 'px,' + translateY + 'px,0)');
751-
repaint(target); // repaint
751+
this.forRepaintDummy = repaint(target); // repaint
752752

753753
css(target, 'transition', 'transform ' + duration + 'ms' + (this.options.easing ? ' ' + this.options.easing : ''));
754754
css(target, 'transform', 'translate3d(0,0,0)');
@@ -786,6 +786,11 @@ var PluginManager = {
786786
}
787787
}
788788

789+
plugins.forEach(function (p) {
790+
if (p.pluginName === plugin.pluginName) {
791+
throw "Sortable: Cannot mount plugin ".concat(plugin.pluginName, " more than once");
792+
}
793+
});
789794
plugins.push(plugin);
790795
},
791796
pluginEvent: function pluginEvent(eventName, sortable, evt) {
@@ -1229,7 +1234,7 @@ function Sortable(el, options) {
12291234
x: 0,
12301235
y: 0
12311236
},
1232-
supportPointer: Sortable.supportPointer !== false && 'PointerEvent' in window,
1237+
supportPointer: Sortable.supportPointer !== false && 'PointerEvent' in window && !Safari,
12331238
emptyInsertThreshold: 5
12341239
};
12351240
PluginManager.initializePlugins(this, el, defaults); // Set default options
@@ -1316,6 +1321,11 @@ Sortable.prototype =
13161321

13171322
if (originalTarget.isContentEditable) {
13181323
return;
1324+
} // Safari ignores further event handling after mousedown
1325+
1326+
1327+
if (!this.nativeDraggable && Safari && target && target.tagName.toUpperCase() === 'SELECT') {
1328+
return;
13191329
}
13201330

13211331
target = closest(target, options.draggable, el, false);
@@ -2313,7 +2323,7 @@ Sortable.prototype =
23132323
* Sorts the elements according to the array.
23142324
* @param {String[]} order order of the items
23152325
*/
2316-
sort: function sort(order) {
2326+
sort: function sort(order, useAnimation) {
23172327
var items = {},
23182328
rootEl = this.el;
23192329
this.toArray().forEach(function (id, i) {
@@ -2323,12 +2333,14 @@ Sortable.prototype =
23232333
items[id] = el;
23242334
}
23252335
}, this);
2336+
useAnimation && this.captureAnimationState();
23262337
order.forEach(function (id) {
23272338
if (items[id]) {
23282339
rootEl.removeChild(items[id]);
23292340
rootEl.appendChild(items[id]);
23302341
}
23312342
});
2343+
useAnimation && this.animateAll();
23322344
},
23332345

23342346
/**
@@ -2427,7 +2439,7 @@ Sortable.prototype =
24272439
pluginEvent('showClone', this);
24282440
if (Sortable.eventCanceled) return; // show clone at dragEl or original position
24292441

2430-
if (rootEl.contains(dragEl) && !this.options.group.revertClone) {
2442+
if (dragEl.parentNode == rootEl && !this.options.group.revertClone) {
24312443
rootEl.insertBefore(cloneEl, dragEl);
24322444
} else if (nextEl) {
24332445
rootEl.insertBefore(cloneEl, nextEl);

modular/sortable.esm.js

+19-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**!
2-
* Sortable 1.10.2
2+
* Sortable 1.13.0
33
* @author RubaXa <[email protected]>
44
* @author owenm <[email protected]>
55
* @license MIT
@@ -126,7 +126,7 @@ function _nonIterableSpread() {
126126
throw new TypeError("Invalid attempt to spread non-iterable instance");
127127
}
128128

129-
var version = "1.10.2";
129+
var version = "1.13.0";
130130

131131
function userAgent(pattern) {
132132
if (typeof window !== 'undefined' && window.navigator) {
@@ -308,7 +308,7 @@ function getRect(el, relativeToContainingBlock, relativeToNonStaticParent, undoS
308308
if (!el.getBoundingClientRect && el !== window) return;
309309
var elRect, top, left, bottom, right, height, width;
310310

311-
if (el !== window && el !== getWindowScrollingElement()) {
311+
if (el !== window && el.parentNode && el !== getWindowScrollingElement()) {
312312
elRect = el.getBoundingClientRect();
313313
top = elRect.top;
314314
left = elRect.left;
@@ -748,7 +748,7 @@ function AnimationStateManager() {
748748
target.animatingX = !!translateX;
749749
target.animatingY = !!translateY;
750750
css(target, 'transform', 'translate3d(' + translateX + 'px,' + translateY + 'px,0)');
751-
repaint(target); // repaint
751+
this.forRepaintDummy = repaint(target); // repaint
752752

753753
css(target, 'transition', 'transform ' + duration + 'ms' + (this.options.easing ? ' ' + this.options.easing : ''));
754754
css(target, 'transform', 'translate3d(0,0,0)');
@@ -786,6 +786,11 @@ var PluginManager = {
786786
}
787787
}
788788

789+
plugins.forEach(function (p) {
790+
if (p.pluginName === plugin.pluginName) {
791+
throw "Sortable: Cannot mount plugin ".concat(plugin.pluginName, " more than once");
792+
}
793+
});
789794
plugins.push(plugin);
790795
},
791796
pluginEvent: function pluginEvent(eventName, sortable, evt) {
@@ -1229,7 +1234,7 @@ function Sortable(el, options) {
12291234
x: 0,
12301235
y: 0
12311236
},
1232-
supportPointer: Sortable.supportPointer !== false && 'PointerEvent' in window,
1237+
supportPointer: Sortable.supportPointer !== false && 'PointerEvent' in window && !Safari,
12331238
emptyInsertThreshold: 5
12341239
};
12351240
PluginManager.initializePlugins(this, el, defaults); // Set default options
@@ -1316,6 +1321,11 @@ Sortable.prototype =
13161321

13171322
if (originalTarget.isContentEditable) {
13181323
return;
1324+
} // Safari ignores further event handling after mousedown
1325+
1326+
1327+
if (!this.nativeDraggable && Safari && target && target.tagName.toUpperCase() === 'SELECT') {
1328+
return;
13191329
}
13201330

13211331
target = closest(target, options.draggable, el, false);
@@ -2313,7 +2323,7 @@ Sortable.prototype =
23132323
* Sorts the elements according to the array.
23142324
* @param {String[]} order order of the items
23152325
*/
2316-
sort: function sort(order) {
2326+
sort: function sort(order, useAnimation) {
23172327
var items = {},
23182328
rootEl = this.el;
23192329
this.toArray().forEach(function (id, i) {
@@ -2323,12 +2333,14 @@ Sortable.prototype =
23232333
items[id] = el;
23242334
}
23252335
}, this);
2336+
useAnimation && this.captureAnimationState();
23262337
order.forEach(function (id) {
23272338
if (items[id]) {
23282339
rootEl.removeChild(items[id]);
23292340
rootEl.appendChild(items[id]);
23302341
}
23312342
});
2343+
useAnimation && this.animateAll();
23322344
},
23332345

23342346
/**
@@ -2427,7 +2439,7 @@ Sortable.prototype =
24272439
pluginEvent('showClone', this);
24282440
if (Sortable.eventCanceled) return; // show clone at dragEl or original position
24292441

2430-
if (rootEl.contains(dragEl) && !this.options.group.revertClone) {
2442+
if (dragEl.parentNode == rootEl && !this.options.group.revertClone) {
24312443
rootEl.insertBefore(cloneEl, dragEl);
24322444
} else if (nextEl) {
24332445
rootEl.insertBefore(cloneEl, nextEl);

0 commit comments

Comments
 (0)