MCPcopy Index your code
hub / github.com/python/cpython / cloneNode

Method cloneNode

Lib/xml/dom/minidom.py:1663–1682  ·  view source on GitHub ↗
(self, deep)

Source from the content-addressed store, hash-verified

1661 Node.unlink(self)
1662
1663 def cloneNode(self, deep):
1664 if not deep:
1665 return None
1666 clone = self.implementation.createDocument(None, None, None)
1667 clone.encoding = self.encoding
1668 clone.standalone = self.standalone
1669 clone.version = self.version
1670 for n in self.childNodes:
1671 childclone = _clone_node(n, deep, clone)
1672 assert childclone.ownerDocument.isSameNode(clone)
1673 clone.childNodes.append(childclone)
1674 if childclone.nodeType == Node.DOCUMENT_NODE:
1675 assert clone.documentElement is None
1676 elif childclone.nodeType == Node.DOCUMENT_TYPE_NODE:
1677 assert clone.doctype is None
1678 clone.doctype = childclone
1679 childclone.parentNode = clone
1680 self._call_user_data_handler(xml.dom.UserDataHandler.NODE_CLONED,
1681 self, clone)
1682 return clone
1683
1684 def createDocumentFragment(self):
1685 d = DocumentFragment()

Callers

nothing calls this directly

Calls 5

_clone_nodeFunction · 0.85
createDocumentMethod · 0.80
isSameNodeMethod · 0.80
appendMethod · 0.45

Tested by

no test coverage detected