diff options
author | Perry Mitchell <perrymitchell@live.com> | 2018-07-22 21:36:02 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-22 21:36:02 +0300 |
commit | 0986f03778578dc09de1128cec4dbcb06d4988ee (patch) | |
tree | 119619b1a9acb7bb7562513085c3d0e35664199f /src | |
parent | a180a4e4fd4d47f7a45db0d3fb66d3df4bfb6749 (diff) | |
download | svg.js-0986f03778578dc09de1128cec4dbcb06d4988ee.tar.gz svg.js-0986f03778578dc09de1128cec4dbcb06d4988ee.zip |
Add global reference to support 'window' in bundlers - fixes #767
Diffstat (limited to 'src')
-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) |