title: Should I call ResizeObserver.unobserve for removed elements?
body: <p>When some observed element gets removed from DOM, should I call <code>.unobserve</code> for that element to prevent memory leaks, or will it be &quot;unobserved automatically&quot;?</p>
  <pre><code>const ro = new ResizeObserver((entries) =&gt; { console.log(entries); });
  const el = document.getElementById('foo');
  ro.observe(el);
  // ... some time later
  el.remove();
  ro.unobserve(el); // &lt;-- is this needed, or does it happen automatically behind the scenes?
  </code></pre>
  <p>Why I'm asking: I'm implementing a React component that observes many children and properly cleaning up the observer for unmounted components would involve non-trivial code, which I want to avoid if it is actually unneeded.</p>