### Method

# Lasem DomNode insert_before

#### Declaration [src]

    LsmDomNode*
    lsm_dom_node_insert_before (
      LsmDomNode* self,
      LsmDomNode* new_child,
      LsmDomNode* ref_child
    )

#### Description [src]

Inserts the node `new_child` before the existing child node `ref_child`. If `ref_child` is null, insert `new_child` at the end of the list of children. If the `new_child` is already in the tree, it is first removed.

#### Parameters

`new_child`

  Type: `LsmDomNode`

  Node to insert.

  The instance takes ownership of the data, and is responsible for freeing it.

`ref_child`

  Type: `LsmDomNode`

  Reference node, i.e., the node before which the new node must be inserted.

  The data is owned by the caller of the method.

#### Return value

Type: `LsmDomNode`

The inserted node.

The returned data is owned by the instance.