summaryrefslogtreecommitdiffstats
path: root/src/element.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/element.js')
-rw-r--r--src/element.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/element.js b/src/element.js
index 01ab8b0..180fbfd 100644
--- a/src/element.js
+++ b/src/element.js
@@ -161,16 +161,16 @@ SVG.Element = SVG.invent({
// get parent element
var parent = SVG.adopt(this.node.parentNode)
- // if a specific type is given, find a parent with that class
+ // if a specific type or selector is given, find a parent with that class
if (type)
- while (!(parent instanceof type) && parent.node.parentNode instanceof SVGElement)
+ while (parent.node.parentNode instanceof SVGElement && !(typeof type === 'string' ? matches(parent.node, type) : parent instanceof type))
parent = SVG.adopt(parent.node.parentNode)
return parent
}
}
// Get parent document
- , doc: function(type) {
+ , doc: function() {
return this instanceof SVG.Doc ? this : this.parent(SVG.Doc)
}
// Returns the svg node to call native svg methods on it