Skip to content

Commit

Permalink
fix(lib): add support for requiring library in non-browser environments
Browse files Browse the repository at this point in the history
  • Loading branch information
jcao02 committed Nov 12, 2017
1 parent 7b9d90e commit 74c0ada
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions dragula.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
var emitter = require('contra/emitter');
var crossvent = require('crossvent');
var classes = require('./classes');
var doc = document;
var documentElement = doc.documentElement;
var inBrowser = 'undefined' !== typeof document; // Check if running in browser environmnet
var doc = inBrowser ? document : undefined;
var documentElement = inBrowser ? doc.documentElement : {};

function dragula (initialContainers, options) {
var len = arguments.length;
Expand Down

0 comments on commit 74c0ada

Please sign in to comment.