moveBefore

open fun moveBefore(node: Node, child: Node?)(source)

The moveBefore() method of the Document interface moves a given Node inside the Document DOM node as a direct child, before a given reference node.

MDN Reference