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 {
9494 * let grid = document.querySelector('.grid-stack').gridstack;
9595 */
9696 public static init ( options : GridStackOptions = { } , elOrString : GridStackElement = '.grid-stack' ) : GridStack {
97+ if ( typeof document === 'undefined' ) {
98+ return null
99+ }
97100 let el = GridStack . getGridElement ( elOrString ) ;
98101 if ( ! el ) {
99102 if ( typeof elOrString === 'string' ) {
@@ -121,6 +124,9 @@ export class GridStack {
121124 */
122125 public static initAll ( options : GridStackOptions = { } , selector = '.grid-stack' ) : GridStack [ ] {
123126 let grids : GridStack [ ] = [ ] ;
127+ if ( typeof document === 'undefined' ) {
128+ return grids
129+ }
124130 GridStack . getGridElements ( selector ) . forEach ( el => {
125131 if ( ! el . gridstack ) {
126132 el . gridstack = new GridStack ( el , Utils . cloneDeep ( options ) ) ;
You can’t perform that action at this time.
0 commit comments