在d3程序中,我需要获取一个节点(带有d3.selection)然后我想插入相同的svg.
我知道有一些函数,如append和insert,但这些函数适用于新元素.
var node = d3.select("rect#someId"); //node with some attributes and listeners
Run Code Online (Sandbox Code Playgroud)
现在我的var节点获得了以下属性:{_ groups,_parents}
var anotherNode = d3.select("anotherNode").insert(node); //It work but it would be great a similar function or a workaround
Run Code Online (Sandbox Code Playgroud)
注意.我需要保留节点的监听器