在d3程序中,我需要获取一个节点(使用d3.selection),然后我想插入相同的svg。复制并插入到d3选择中
我知道有一些函数像append和insert,但是这些函数是用于新元素的。现在
var node = d3.select("rect#someId"); //node with some attributes and listeners
我的VAR节点有以下属性: {_groups,_parents}
var anotherNode = d3.select("anotherNode").insert(node); //It work but it would be great a similar function or a workaround
注意。我需要保持节点
看看[*“如何使用事件监听器复制DOM节点?”](/ q/15408394)。 – altocumulus