Inserting. The modern methods are parent.append() and prepend(), and on the node itself before(), after() and replaceWith(). Each takes any number of nodes and strings; strings become Text nodes, so they're never parsed as HTML. With several arguments the DOM Standard first collects them into a DocumentFragment, so the insert happens once. The older appendChild() and insertBefore() take one node and return it.
Moving. A node can have only one parent. Inserting a node that's already in the tree first removes it from its old position: there's no copy unless you cloneNode(true).
Removing. node.remove(), or parent.replaceChildren() with no arguments to empty a parent. replaceChildren(...nodes) replaces every child in one step, which makes it the clean way to re-render a list.
Fragments. A DocumentFragment is a parentless container. Inserting it moves its children and leaves the fragment empty, so you can build many nodes off-tree and insert once.
Why batching matters. Each insertion runs the insertion steps: mutation records, custom element callbacks, and side effects such as scripts running or iframes loading. Layout is computed lazily, so a loop of insertions isn't re-laid out per node unless you read geometry (offsetHeight) between writes, which forces synchronous layout. Build first, insert once, read afterwards.
moveBefore(node, child) is an atomic move. insertBefore() on a connected node is a remove plus an insert, so an iframe reloads, a focused element loses focus, and running CSS animations restart. moveBefore() runs separate moving steps that keep that state. It throws HierarchyRequestError when the node and the new parent don't share a root (for example, a node not yet in the document) or the node isn't an element or character data, so fall back to insertBefore() there. It shipped in Chrome 133 and Firefox 144; Safari doesn't have it.