Creates cloned copies of all elements in the collection, and returns the copies in a new collection. deep
is a boolean value to indicate if the entire child node structure of the cloned nodes should be included (default false
).
In this example, click anywhere to clone and append a new square:
var svg = Pablo(demoElement).svg({height:40})
square = svg.rect({width:40, height:40}),
x = 0;
svg.on('click', function(){
x += 50;
square.clone()
// Set x position
.attr('x', x)
.appendTo(svg);
});