d3-selection
Version:
Data-driven DOM manipulation: select elements and join them to data.
19 lines (14 loc) • 421 B
JavaScript
import {childMatcher} from "../matcher.js";
var filter = Array.prototype.filter;
function children() {
return Array.from(this.children);
}
function childrenFilter(match) {
return function() {
return filter.call(this.children, match);
};
}
export default function(match) {
return this.selectAll(match == null ? children
: childrenFilter(typeof match === "function" ? match : childMatcher(match)));
}