MutationObserver API
The MutationObserver API is the browser interface that notifies JavaScript of DOM changes, delivering batched records of added and removed nodes, attribute changes, and text edits. It is the native primitive that makes efficient session recording possible, replacing the deprecated, per-change Mutation Events of the past.
How it works
Code constructs an observer with a callback, then calls observe(target, options) with flags for childList, attributes, characterData, and subtree. The rrweb observer documentation explains how these batches are handled during recording. The browser queues mutation records and delivers them as a microtask batch. A thousand DOM writes in one task can produce one callback with many records, but the callback still runs on the main thread and can delay rendering if it does too much work. The API reports what changed, not a replay-ready serialized form. rrweb pairs it with a serializer and resolves intra-batch ordering for nodes that were added, moved, or modified before delivery. The DOM Standard is the source for the API's delivery model.
Where you encounter it
Under every DOM-based recorder and in framework internals; developers ultimately choose between using the raw API and building on rrweb.