PassRefPtr<Node> DocumentFragment::cloneNode(bool deep) { RefPtr<DocumentFragment> clone = create(document()); if (deep) cloneChildNodes(clone.get()); return clone.release(); }
PassRefPtr<Node> EntityReference::cloneNode(bool deep) { RefPtr<EntityReference> clone = new EntityReference(document(), m_entityName.get()); // ### make sure children are readonly // ### since we are a reference, should we clone children anyway (even if not deep?) if (deep) cloneChildNodes(clone.get()); return clone.release(); }
Ref<Node> DocumentFragment::cloneNodeInternal(Document& targetDocument, CloningOperation type) { Ref<DocumentFragment> clone = create(targetDocument); switch (type) { case CloningOperation::OnlySelf: case CloningOperation::SelfWithTemplateContent: break; case CloningOperation::Everything: cloneChildNodes(clone); break; } return WTF::move(clone); }
PassRefPtr<Node> Element::cloneNode(bool deep) { ExceptionCode ec = 0; RefPtr<Element> clone = document()->createElementNS(namespaceURI(), nodeName(), ec); ASSERT(!ec); // clone attributes if (namedAttrMap) clone->attributes()->setAttributes(*namedAttrMap); clone->copyNonAttributeProperties(this); if (deep) cloneChildNodes(clone.get()); return clone.release(); }
PassRefPtr<Element> Element::cloneElementWithChildren() { RefPtr<Element> clone = cloneElementWithoutChildren(); cloneChildNodes(clone.get()); return clone.release(); }