From bc4542df03c147fbee1bc34d1b987ef6c4e7872e Mon Sep 17 00:00:00 2001 From: Ulrich-Matthias Schäfer Date: Sat, 18 Mar 2017 13:07:00 +0100 Subject: prefix globals with window so window can be injected properly --- src/element.js | 2 +- src/event.js | 4 ++-- src/helpers.js | 2 +- src/svg.js | 2 +- src/utilities.js | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/element.js b/src/element.js index 03271ca..24770b1 100644 --- a/src/element.js +++ b/src/element.js @@ -172,7 +172,7 @@ SVG.Element = SVG.invent({ if(!type) return parent // loop trough ancestors if type is given - while(parent && parent.node instanceof SVGElement){ + while(parent && parent.node instanceof window.SVGElement){ if(typeof type === 'string' ? parent.matches(type) : parent instanceof type) return parent parent = SVG.adopt(parent.node.parentNode) } diff --git a/src/event.js b/src/event.js index 32c2cc6..115e175 100644 --- a/src/event.js +++ b/src/event.js @@ -133,10 +133,10 @@ SVG.extend(SVG.Element, { , fire: function(event, data) { // Dispatch event - if(event instanceof Event){ + if(event instanceof window.Event){ this.node.dispatchEvent(event) }else{ - this.node.dispatchEvent(event = new CustomEvent(event, {detail:data, cancelable: true})) + this.node.dispatchEvent(event = new window.CustomEvent(event, {detail:data, cancelable: true})) } this._event = event diff --git a/src/helpers.js b/src/helpers.js index 744a712..461975a 100644 --- a/src/helpers.js +++ b/src/helpers.js @@ -150,7 +150,7 @@ function arrayToString(a) { function assignNewId(node) { // do the same for SVG child nodes as well for (var i = node.childNodes.length - 1; i >= 0; i--) - if (node.childNodes[i] instanceof SVGElement) + if (node.childNodes[i] instanceof window.SVGElement) assignNewId(node.childNodes[i]) return SVG.adopt(node).id(SVG.eid(node.nodeName)) diff --git a/src/svg.js b/src/svg.js index 0d5e69e..c5bc069 100644 --- a/src/svg.js +++ b/src/svg.js @@ -97,7 +97,7 @@ SVG.adopt = function(node) { // adopt with element-specific settings if (node.nodeName == 'svg') - element = node.parentNode instanceof SVGElement ? new SVG.Nested : new SVG.Doc + element = node.parentNode instanceof window.SVGElement ? new SVG.Nested : new SVG.Doc else if (node.nodeName == 'linearGradient') element = new SVG.Gradient('linear') else if (node.nodeName == 'radialGradient') diff --git a/src/utilities.js b/src/utilities.js index aeae87f..c41e8e4 100644 --- a/src/utilities.js +++ b/src/utilities.js @@ -35,7 +35,7 @@ SVG.utils = { } , filterSVGElements: function(nodes) { - return this.filter( nodes, function(el) { return el instanceof SVGElement }) + return this.filter( nodes, function(el) { return el instanceof window.SVGElement }) } } \ No newline at end of file -- cgit v1.2.3