According to the spec https://drafts.csswg.org/resize-observer/#dom-resizeobserver-unobserve, we should not be clearing the active targets when unobserve is called.
Looks like Chrome has the same bug so that's a bit concerning...
Created attachment 434729 [details] Patch
Comment on attachment 434729 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=434729&action=review r=me with changelog fix. > LayoutTests/ChangeLog:13 > +2021-08-01 Ryosuke Niwa <rniwa@webkit.org> double change log.
Comment on attachment 434729 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=434729&action=review >> LayoutTests/ChangeLog:13 >> +2021-08-01 Ryosuke Niwa <rniwa@webkit.org> > > double change log. Weird. Not sure what happened here. Will fix before landing.
Committed r280551 (240178@main): <https://commits.webkit.org/240178@main>
<rdar://problem/81425446>
This might be a spec misunderstanding: From the spec: [[activeTargets]] represents all Elements whose size has changed since last observation broadcast that are eligible for broadcast. What makes an element eligible is not explicitly defined. My intuition is that calling "unobserve" on an elment should make it inelligible.
Filed spec bug: https://github.com/w3c/csswg-drafts/issues/6493