internalCloneWithOwnerDocument method
Implementation
@override
SvgElement internalCloneWithOwnerDocument(Document ownerDocument, bool deep) {
// Create a new instance of the same class
final clone = SvgElement.tag(tagName);
// Clone attributes
attributes.forEach((name, value) {
clone.setAttribute(name, value);
});
// Clone children
if (deep != false) {
for (var childNode in childNodes) {
clone.append(
// ignore: invalid_use_of_visible_for_testing_member
childNode.internalCloneWithOwnerDocument(ownerDocument, deep),
);
}
}
return clone;
}