UNPKG

d3-selection

Version:

Data-driven DOM manipulation: select elements and join them to data.

15 lines (12 loc) 474 B
import creator from "../creator.js"; import selector from "../selector.js"; function constantNull() { return null; } export default function(name, before) { var create = typeof name === "function" ? name : creator(name), select = before == null ? constantNull : typeof before === "function" ? before : selector(before); return this.select(function() { return this.insertBefore(create.apply(this, arguments), select.apply(this, arguments) || null); }); }