File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -94,6 +94,9 @@ export class GridStack {
94
94
* let grid = document.querySelector('.grid-stack').gridstack;
95
95
*/
96
96
public static init ( options : GridStackOptions = { } , elOrString : GridStackElement = '.grid-stack' ) : GridStack {
97
+ if ( typeof document === 'undefined' ) {
98
+ return null
99
+ }
97
100
let el = GridStack . getGridElement ( elOrString ) ;
98
101
if ( ! el ) {
99
102
if ( typeof elOrString === 'string' ) {
@@ -121,6 +124,9 @@ export class GridStack {
121
124
*/
122
125
public static initAll ( options : GridStackOptions = { } , selector = '.grid-stack' ) : GridStack [ ] {
123
126
let grids : GridStack [ ] = [ ] ;
127
+ if ( typeof document === 'undefined' ) {
128
+ return grids
129
+ }
124
130
GridStack . getGridElements ( selector ) . forEach ( el => {
125
131
if ( ! el . gridstack ) {
126
132
el . gridstack = new GridStack ( el , Utils . cloneDeep ( options ) ) ;
You can’t perform that action at this time.
0 commit comments