diff --git a/src/Sortable.js b/src/Sortable.js index 7a8274d216a9e4efd462a65b004cb2e244b65d3f..8df9be449e5d9fb649f86497669262cbdc70d8e4 100644 --- a/src/Sortable.js +++ b/src/Sortable.js @@ -5,6 +5,8 @@ * @license MIT */ +import './windowCheck.js'; // Always import first + import { version } from '../package.json'; import { IE11OrLess, Edge, FireFox, Safari, IOS, ChromeForAndroid } from './BrowserInfo.js'; @@ -92,10 +94,6 @@ function _dispatchEvent(info) { } -if (typeof window === "undefined" || !window.document) { - throw new Error("Sortable.js requires a window with a document"); -} - let dragEl, parentEl, ghostEl, diff --git a/src/windowCheck.js b/src/windowCheck.js new file mode 100644 index 0000000000000000000000000000000000000000..e6cf9e033d877e2d527a9ef0c2cada18ab85cc53 --- /dev/null +++ b/src/windowCheck.js @@ -0,0 +1,3 @@ +if (typeof window === "undefined" || !window.document) { + throw new Error("Sortable.js requires a window with a document"); +}