summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2017-03-18 13:07:00 +0100
committerUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2017-03-18 13:07:00 +0100
commitbc4542df03c147fbee1bc34d1b987ef6c4e7872e (patch)
treeb00a3fa35aa2b2cd94b66b966de60ea236b85367 /src
parent39e2593a2ca08c548fbcf92e88b772bb051dd589 (diff)
downloadsvg.js-bc4542df03c147fbee1bc34d1b987ef6c4e7872e.tar.gz
svg.js-bc4542df03c147fbee1bc34d1b987ef6c4e7872e.zip
prefix globals with window so window can be injected properly
Diffstat (limited to 'src')
-rw-r--r--src/element.js2
-rw-r--r--src/event.js4
-rw-r--r--src/helpers.js2
-rw-r--r--src/svg.js2
-rw-r--r--src/utilities.js2
5 files changed, 6 insertions, 6 deletions
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