aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/svg.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/svg.js b/src/svg.js
index ee8832e..b28bef6 100644
--- a/src/svg.js
+++ b/src/svg.js
@@ -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)