Skip to content

Commit 8d7cb88

Browse files
committed
1.10.1
1 parent 278b587 commit 8d7cb88

File tree

6 files changed

+131
-107
lines changed

6 files changed

+131
-107
lines changed

Sortable.js

Lines changed: 32 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**!
2-
* Sortable 1.10.0
2+
* Sortable 1.10.1
33
* @author RubaXa <[email protected]>
44
* @author owenm <[email protected]>
55
* @license MIT
@@ -132,12 +132,14 @@
132132
throw new TypeError("Invalid attempt to spread non-iterable instance");
133133
}
134134

135-
var version = "1.10.0";
135+
var version = "1.10.1";
136136

137137
function userAgent(pattern) {
138-
return !!
139-
/*@__PURE__*/
140-
navigator.userAgent.match(pattern);
138+
if (typeof window !== 'undefined' && window.navigator) {
139+
return !!
140+
/*@__PURE__*/
141+
navigator.userAgent.match(pattern);
142+
}
141143
}
142144

143145
var IE11OrLess = userAgent(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i);
@@ -972,10 +974,6 @@
972974
}, info));
973975
}
974976

975-
if (typeof window === "undefined" || !window.document) {
976-
throw new Error("Sortable.js requires a window with a document");
977-
}
978-
979977
var dragEl,
980978
parentEl,
981979
ghostEl,
@@ -1013,12 +1011,14 @@
10131011
savedInputChecked = [];
10141012
/** @const */
10151013

1016-
var PositionGhostAbsolutely = IOS,
1014+
var documentExists = typeof document !== 'undefined',
1015+
PositionGhostAbsolutely = IOS,
10171016
CSSFloatProperty = Edge || IE11OrLess ? 'cssFloat' : 'float',
10181017
// This will not pass for IE9, because IE9 DnD only works on anchors
1019-
supportDraggable = !ChromeForAndroid && !IOS && 'draggable' in document.createElement('div'),
1018+
supportDraggable = documentExists && !ChromeForAndroid && !IOS && 'draggable' in document.createElement('div'),
10201019
supportCssPointerEvents = function () {
1021-
// false when <= IE11
1020+
if (!documentExists) return; // false when <= IE11
1021+
10221022
if (IE11OrLess) {
10231023
return false;
10241024
}
@@ -1132,15 +1132,17 @@
11321132
}; // #1184 fix - Prevent click event on fallback if dragged but item not changed position
11331133

11341134

1135-
document.addEventListener('click', function (evt) {
1136-
if (ignoreNextClick) {
1137-
evt.preventDefault();
1138-
evt.stopPropagation && evt.stopPropagation();
1139-
evt.stopImmediatePropagation && evt.stopImmediatePropagation();
1140-
ignoreNextClick = false;
1141-
return false;
1142-
}
1143-
}, true);
1135+
if (documentExists) {
1136+
document.addEventListener('click', function (evt) {
1137+
if (ignoreNextClick) {
1138+
evt.preventDefault();
1139+
evt.stopPropagation && evt.stopPropagation();
1140+
evt.stopImmediatePropagation && evt.stopImmediatePropagation();
1141+
ignoreNextClick = false;
1142+
return false;
1143+
}
1144+
}, true);
1145+
}
11441146

11451147
var nearestEmptyInsertDetectEvent = function nearestEmptyInsertDetectEvent(evt) {
11461148
if (dragEl) {
@@ -2600,11 +2602,14 @@
26002602
} // Fixed #973:
26012603

26022604

2603-
on(document, 'touchmove', function (evt) {
2604-
if ((Sortable.active || awaitingDragStarted) && evt.cancelable) {
2605-
evt.preventDefault();
2606-
}
2607-
}); // Export utils
2605+
if (documentExists) {
2606+
on(document, 'touchmove', function (evt) {
2607+
if ((Sortable.active || awaitingDragStarted) && evt.cancelable) {
2608+
evt.preventDefault();
2609+
}
2610+
});
2611+
} // Export utils
2612+
26082613

26092614
Sortable.utils = {
26102615
on: on,
@@ -2906,6 +2911,7 @@
29062911
dispatchSortableEvent = _ref.dispatchSortableEvent,
29072912
hideGhostForTarget = _ref.hideGhostForTarget,
29082913
unhideGhostForTarget = _ref.unhideGhostForTarget;
2914+
if (!originalEvent) return;
29092915
var toSortable = putSortable || activeSortable;
29102916
hideGhostForTarget();
29112917
var touch = originalEvent.changedTouches && originalEvent.changedTouches.length ? originalEvent.changedTouches[0] : originalEvent;

Sortable.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

modular/sortable.complete.esm.js

Lines changed: 32 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**!
2-
* Sortable 1.10.0
2+
* Sortable 1.10.1
33
* @author RubaXa <[email protected]>
44
* @author owenm <[email protected]>
55
* @license MIT
@@ -126,12 +126,14 @@ function _nonIterableSpread() {
126126
throw new TypeError("Invalid attempt to spread non-iterable instance");
127127
}
128128

129-
var version = "1.10.0";
129+
var version = "1.10.1";
130130

131131
function userAgent(pattern) {
132-
return !!
133-
/*@__PURE__*/
134-
navigator.userAgent.match(pattern);
132+
if (typeof window !== 'undefined' && window.navigator) {
133+
return !!
134+
/*@__PURE__*/
135+
navigator.userAgent.match(pattern);
136+
}
135137
}
136138

137139
var IE11OrLess = userAgent(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i);
@@ -966,10 +968,6 @@ function _dispatchEvent(info) {
966968
}, info));
967969
}
968970

969-
if (typeof window === "undefined" || !window.document) {
970-
throw new Error("Sortable.js requires a window with a document");
971-
}
972-
973971
var dragEl,
974972
parentEl,
975973
ghostEl,
@@ -1007,12 +1005,14 @@ _silent = false,
10071005
savedInputChecked = [];
10081006
/** @const */
10091007

1010-
var PositionGhostAbsolutely = IOS,
1008+
var documentExists = typeof document !== 'undefined',
1009+
PositionGhostAbsolutely = IOS,
10111010
CSSFloatProperty = Edge || IE11OrLess ? 'cssFloat' : 'float',
10121011
// This will not pass for IE9, because IE9 DnD only works on anchors
1013-
supportDraggable = !ChromeForAndroid && !IOS && 'draggable' in document.createElement('div'),
1012+
supportDraggable = documentExists && !ChromeForAndroid && !IOS && 'draggable' in document.createElement('div'),
10141013
supportCssPointerEvents = function () {
1015-
// false when <= IE11
1014+
if (!documentExists) return; // false when <= IE11
1015+
10161016
if (IE11OrLess) {
10171017
return false;
10181018
}
@@ -1126,15 +1126,17 @@ _detectNearestEmptySortable = function _detectNearestEmptySortable(x, y) {
11261126
}; // #1184 fix - Prevent click event on fallback if dragged but item not changed position
11271127

11281128

1129-
document.addEventListener('click', function (evt) {
1130-
if (ignoreNextClick) {
1131-
evt.preventDefault();
1132-
evt.stopPropagation && evt.stopPropagation();
1133-
evt.stopImmediatePropagation && evt.stopImmediatePropagation();
1134-
ignoreNextClick = false;
1135-
return false;
1136-
}
1137-
}, true);
1129+
if (documentExists) {
1130+
document.addEventListener('click', function (evt) {
1131+
if (ignoreNextClick) {
1132+
evt.preventDefault();
1133+
evt.stopPropagation && evt.stopPropagation();
1134+
evt.stopImmediatePropagation && evt.stopImmediatePropagation();
1135+
ignoreNextClick = false;
1136+
return false;
1137+
}
1138+
}, true);
1139+
}
11381140

11391141
var nearestEmptyInsertDetectEvent = function nearestEmptyInsertDetectEvent(evt) {
11401142
if (dragEl) {
@@ -2594,11 +2596,14 @@ function _cancelNextTick(id) {
25942596
} // Fixed #973:
25952597

25962598

2597-
on(document, 'touchmove', function (evt) {
2598-
if ((Sortable.active || awaitingDragStarted) && evt.cancelable) {
2599-
evt.preventDefault();
2600-
}
2601-
}); // Export utils
2599+
if (documentExists) {
2600+
on(document, 'touchmove', function (evt) {
2601+
if ((Sortable.active || awaitingDragStarted) && evt.cancelable) {
2602+
evt.preventDefault();
2603+
}
2604+
});
2605+
} // Export utils
2606+
26022607

26032608
Sortable.utils = {
26042609
on: on,
@@ -2900,6 +2905,7 @@ var drop = function drop(_ref) {
29002905
dispatchSortableEvent = _ref.dispatchSortableEvent,
29012906
hideGhostForTarget = _ref.hideGhostForTarget,
29022907
unhideGhostForTarget = _ref.unhideGhostForTarget;
2908+
if (!originalEvent) return;
29032909
var toSortable = putSortable || activeSortable;
29042910
hideGhostForTarget();
29052911
var touch = originalEvent.changedTouches && originalEvent.changedTouches.length ? originalEvent.changedTouches[0] : originalEvent;

modular/sortable.core.esm.js

Lines changed: 32 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**!
2-
* Sortable 1.10.0
2+
* Sortable 1.10.1
33
* @author RubaXa <[email protected]>
44
* @author owenm <[email protected]>
55
* @license MIT
@@ -126,12 +126,14 @@ function _nonIterableSpread() {
126126
throw new TypeError("Invalid attempt to spread non-iterable instance");
127127
}
128128

129-
var version = "1.10.0";
129+
var version = "1.10.1";
130130

131131
function userAgent(pattern) {
132-
return !!
133-
/*@__PURE__*/
134-
navigator.userAgent.match(pattern);
132+
if (typeof window !== 'undefined' && window.navigator) {
133+
return !!
134+
/*@__PURE__*/
135+
navigator.userAgent.match(pattern);
136+
}
135137
}
136138

137139
var IE11OrLess = userAgent(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i);
@@ -966,10 +968,6 @@ function _dispatchEvent(info) {
966968
}, info));
967969
}
968970

969-
if (typeof window === "undefined" || !window.document) {
970-
throw new Error("Sortable.js requires a window with a document");
971-
}
972-
973971
var dragEl,
974972
parentEl,
975973
ghostEl,
@@ -1007,12 +1005,14 @@ _silent = false,
10071005
savedInputChecked = [];
10081006
/** @const */
10091007

1010-
var PositionGhostAbsolutely = IOS,
1008+
var documentExists = typeof document !== 'undefined',
1009+
PositionGhostAbsolutely = IOS,
10111010
CSSFloatProperty = Edge || IE11OrLess ? 'cssFloat' : 'float',
10121011
// This will not pass for IE9, because IE9 DnD only works on anchors
1013-
supportDraggable = !ChromeForAndroid && !IOS && 'draggable' in document.createElement('div'),
1012+
supportDraggable = documentExists && !ChromeForAndroid && !IOS && 'draggable' in document.createElement('div'),
10141013
supportCssPointerEvents = function () {
1015-
// false when <= IE11
1014+
if (!documentExists) return; // false when <= IE11
1015+
10161016
if (IE11OrLess) {
10171017
return false;
10181018
}
@@ -1126,15 +1126,17 @@ _detectNearestEmptySortable = function _detectNearestEmptySortable(x, y) {
11261126
}; // #1184 fix - Prevent click event on fallback if dragged but item not changed position
11271127

11281128

1129-
document.addEventListener('click', function (evt) {
1130-
if (ignoreNextClick) {
1131-
evt.preventDefault();
1132-
evt.stopPropagation && evt.stopPropagation();
1133-
evt.stopImmediatePropagation && evt.stopImmediatePropagation();
1134-
ignoreNextClick = false;
1135-
return false;
1136-
}
1137-
}, true);
1129+
if (documentExists) {
1130+
document.addEventListener('click', function (evt) {
1131+
if (ignoreNextClick) {
1132+
evt.preventDefault();
1133+
evt.stopPropagation && evt.stopPropagation();
1134+
evt.stopImmediatePropagation && evt.stopImmediatePropagation();
1135+
ignoreNextClick = false;
1136+
return false;
1137+
}
1138+
}, true);
1139+
}
11381140

11391141
var nearestEmptyInsertDetectEvent = function nearestEmptyInsertDetectEvent(evt) {
11401142
if (dragEl) {
@@ -2594,11 +2596,14 @@ function _cancelNextTick(id) {
25942596
} // Fixed #973:
25952597

25962598

2597-
on(document, 'touchmove', function (evt) {
2598-
if ((Sortable.active || awaitingDragStarted) && evt.cancelable) {
2599-
evt.preventDefault();
2600-
}
2601-
}); // Export utils
2599+
if (documentExists) {
2600+
on(document, 'touchmove', function (evt) {
2601+
if ((Sortable.active || awaitingDragStarted) && evt.cancelable) {
2602+
evt.preventDefault();
2603+
}
2604+
});
2605+
} // Export utils
2606+
26022607

26032608
Sortable.utils = {
26042609
on: on,
@@ -2900,6 +2905,7 @@ var drop = function drop(_ref) {
29002905
dispatchSortableEvent = _ref.dispatchSortableEvent,
29012906
hideGhostForTarget = _ref.hideGhostForTarget,
29022907
unhideGhostForTarget = _ref.unhideGhostForTarget;
2908+
if (!originalEvent) return;
29032909
var toSortable = putSortable || activeSortable;
29042910
hideGhostForTarget();
29052911
var touch = originalEvent.changedTouches && originalEvent.changedTouches.length ? originalEvent.changedTouches[0] : originalEvent;

0 commit comments

Comments
 (0)