Yeah, you currently have to use the DOM API for this. Something like:
function clone(selector) {
var node = d3.select(selector).node();
return d3.select(node.parentNode.insertBefore(node.cloneNode(true),
node.nextSibling));
}
Then you can say clone("#blah") to select a clone of #blah. You could
made a cloneAll, too:
function cloneAll(selector) {
var nodes = d3.selectAll(selector);
nodes.each(function(d, i) {
nodes[0][i] = this.parentNode.insertBefore(this.cloneNode(true),
this.nextSibling);
});
return nodes;
}
Mike