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:13:54 +0100
commitc482c602500494c8f30357284fd873046296ab65 (patch)
treeab63ed28993257cef93c03a6957722650f3609b5 /src
parentb9bf23473e782ef16ae0d51dc840051451a3fc03 (diff)
downloadsvg.js-c482c602500494c8f30357284fd873046296ab65.tar.gz
svg.js-c482c602500494c8f30357284fd873046296ab65.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 9bb8a0a..1c35b42 100644
--- a/src/element.js
+++ b/src/element.js
@@ -176,7 +176,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 e3ad6f0..90c4995 100644
--- a/src/helpers.js
+++ b/src/helpers.js
@@ -136,7 +136,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 b94b08a..b613052 100644
--- a/src/svg.js
+++ b/src/svg.js
@@ -101,7 +101,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