diff options
author | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2018-07-22 22:14:00 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-22 22:14:00 +0200 |
commit | 9a6dea2e5abdbf83b3f75d5dd3707eed0f690859 (patch) | |
tree | 731ae2a19a6dab3777d17fbbb3321a1b7e18b3a8 | |
parent | a180a4e4fd4d47f7a45db0d3fb66d3df4bfb6749 (diff) | |
parent | 66e3a8fe76cc920d34f35271138253a28c5fb22d (diff) | |
download | svg.js-9a6dea2e5abdbf83b3f75d5dd3707eed0f690859.tar.gz svg.js-9a6dea2e5abdbf83b3f75d5dd3707eed0f690859.zip |
Merge pull request #883 from perry-mitchell/patch-1
Add global reference to support 'window' in bundlers - fixes #767
-rw-r--r-- | src/svg.js | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -1,5 +1,9 @@ +// Find global reference - uses 'this' by default when available, +// falls back to 'window' otherwise (for bundlers like Webpack) +var globalRef = (typeof this !== "undefined") ? this : window; + // The main wrapping element -var SVG = this.SVG = function(element) { +var SVG = globalRef.SVG = function(element) { if (SVG.supported) { element = new SVG.Doc(element) |