You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"""Indirect accessor to set the 'owner_document' property."""
267
267
self._owner_document=owner_document
268
268
269
+
definsert_before(self,
270
+
new_child: _AnyNode,
271
+
ref_child: Optional[_AnyNode] =None) ->_AnyNode:
272
+
"""Inserts the node `new_child` before the existing child node `ref_child`. If `ref_child` is `None`, insert `new_child` at the end of the list of children.
273
+
274
+
If `new_child` is a `DocumentFragment` object, all of its children are inserted, in the same order, before `ref_child`. If the `new_child` is already in the tree, it is first removed.
275
+
276
+
Args:
277
+
new_child: The node to insert.
278
+
ref_child: The reference node, i.e., the node before which the new node must be inserted.
279
+
280
+
Returns:
281
+
The node being inserted.
282
+
283
+
Raises:
284
+
DOMException:
285
+
- `HIERARCHY_REQUEST_ERR`: Raised if this node is of a type that does not allow children of the type of the `new_child` node, or if the node to insert is one of this node's ancestors.
286
+
- `WRONG_DOCUMENT_ERR`: Raised if `new_child` was created from a different document than the one that created this node.
287
+
- `NO_MODIFICATION_ALLOWED_ERR`: Raised if this node is readonly.
288
+
- `NOT_FOUND_ERR`: Raised if `ref_child` is not a child of this node.
0 commit comments