From 5fccf71d9c9971a48acc6aa02d911bd9ebfeed08 Mon Sep 17 00:00:00 2001 From: owen-m1 Date: Fri, 27 Sep 2019 19:17:08 -0400 Subject: [PATCH] #1646: Fix SSR rendering --- src/Sortable.js | 6 ++---- src/windowCheck.js | 3 +++ 2 files changed, 5 insertions(+), 4 deletions(-) create mode 100644 src/windowCheck.js diff --git a/src/Sortable.js b/src/Sortable.js index 7a8274d..8df9be4 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 0000000..e6cf9e0 --- /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"); +} -- GitLab