Rara changes #target, Bagas writes a slip for every change the observe() options cover, and the teacher reads the stack. When, and how many slips at a time?…
Before MutationObserver people used polling (setInterval) or the deprecated, slow mutation events. Now: async, bundled, cheap. It is used to spot content another library inserts, in rich text editors, to sync state, and to auto-init components that show up later.
One callback per microtask, not one per change
records, never assume there is one.disconnect() in a useEffect cleanup Return () => observer.disconnect() from the effect. Without it the observer lives on through every re-mount and leaks. If the last records matter, call observer.takeRecords() first: disconnect() throws away what is still queued.observe() with no type flag → TypeError At least one of childList / attributes / characterData must be true. subtree is only a modifier, alone it still throws. (attributeOldValue: true without attributes counts as attributes: true.)+li with no await One callback, records.length === 3. The records pile up in the queue first.await between the changes The callback splits: one per stretch of sync code.subtree, then change p.aktif or +li The DOM changes, but there is no record: changes in descendants are not noted.disconnect() right after a change The queued records are thrown away, the callback never runs.