Esempio n. 1
0
 def _insert_element_before(self, node: Node, ref_node: Node) -> Node:
     if node.parentNode:
         node.parentNode.removeChild(node)
     self._children.insert(self.index(ref_node), node)
     node._parent = self
     return node
Esempio n. 2
0
 def _remove_child(self, node: Node) -> Node:
     if node not in self._children:
         raise ValueError('node to be removed is not a child of this node.')
     self._children.remove(node)
     node._parent = None
     return node
Esempio n. 3
0
 def _append_element(self, node: Node) -> Node:
     if node.parentNode:
         node.parentNode.removeChild(node)
     self._children.append(node)
     node._parent = self
     return node