ResizeObserver is the per-element counterpart of window's resize event. observer.observe(el, { box }) watches one box of the element: 'content-box' (the default), 'border-box' or 'device-pixel-content-box'. When that box's size differs from the last size reported, the element gets an entry. The first check always differs, so every observe() produces an initial entry, even for a display: none element (0 × 0).
Each ResizeObserverEntry has:
contentBoxSize,borderBoxSize,devicePixelContentBoxSize: frozen arrays of{ inlineSize, blockSize }, logical sizes that followwriting-mode. They're arrays so that fragmented elements (multi-column) can someday report each fragment; today they hold one item.contentRect: the legacy physical rectangle, kept for compatibility.
The callbacks run inside the browser's rendering update, after style and layout and before paint, so reading sizes there is cheap and changes made there show in the same frame.
Only layout size counts. transform never triggers a callback, and changing padding doesn't trigger a content-box observation.
The loop error. Resizing elements inside the callback forces another layout, and the browser loops: it recomputes layout and delivers again, but only to observations of elements deeper in the tree than the shallowest one just delivered. Anything at the same depth or shallower is skipped for this frame, delivered in the next one, and the browser reports an ErrorEvent at window with the message "ResizeObserver loop completed with undelivered notifications." It isn't thrown, so try/catch can't see it, but window.onerror and error-monitoring tools do.
The depth rule guarantees the loop ends. The fix is to not resize what you observe from its own callback, or to make the change converge. When the reaction is pure styling, CSS container queries do it without script.