22 lines
523 B
JavaScript
22 lines
523 B
JavaScript
// Method for getting an element by id
|
|
SVG.get = function(id) {
|
|
var node = document.getElementById(idFromReference(id) || id)
|
|
return SVG.adopt(node)
|
|
}
|
|
|
|
// Select elements by query string
|
|
SVG.select = function(query, parent) {
|
|
return new SVG.Set(
|
|
SVG.utils.map((parent || document).querySelectorAll(query), function(node) {
|
|
return SVG.adopt(node)
|
|
})
|
|
)
|
|
}
|
|
|
|
SVG.extend(SVG.Parent, {
|
|
// Scoped select method
|
|
select: function(query) {
|
|
return SVG.select(query, this.node)
|
|
}
|
|
|
|
}) |