Index: Source/core/svg/SVGUseElement.cpp |
diff --git a/Source/core/svg/SVGUseElement.cpp b/Source/core/svg/SVGUseElement.cpp |
index cdb277c033d1fc467a8d29f2b34f37f3188f3baa..8a8a1d6c16ef63805a0f77bb36f1b581611683fb 100644 |
--- a/Source/core/svg/SVGUseElement.cpp |
+++ b/Source/core/svg/SVGUseElement.cpp |
@@ -650,7 +650,11 @@ void SVGUseElement::expandUseElementsInShadowTree(Node* element) |
// Don't ASSERT(target) here, it may be "pending", too. |
// Setup sub-shadow tree root node |
RefPtr<SVGGElement> cloneParent = SVGGElement::create(referencedScope()->document()); |
- use->cloneChildNodes(cloneParent.get()); |
+ for (Node* child = use->firstChild(); child;) { |
+ Node* oldChild = child; |
+ child = child->nextSibling(); |
+ cloneParent->appendChild(oldChild); |
+ } |
// Spec: In the generated content, the 'use' will be replaced by 'g', where all attributes from the |
// 'use' element except for x, y, width, height and xlink:href are transferred to the generated 'g' element. |
@@ -705,9 +709,10 @@ void SVGUseElement::expandSymbolElementsInShadowTree(Node* element) |
svgElement->cloneDataFromElement(*toElement(element)); |
// Only clone symbol children, and add them to the new <svg> element |
- for (Node* child = element->firstChild(); child; child = child->nextSibling()) { |
- RefPtr<Node> newChild = child->cloneNode(true); |
- svgElement->appendChild(newChild.release()); |
+ for (Node* child = toSVGElement(element)->firstChild(); child;) { |
+ Node* oldChild = child; |
+ child = child->nextSibling(); |
+ svgElement->appendChild(oldChild); |
} |
// We don't walk the target tree element-by-element, and clone each element, |