Re: [csswg-drafts] [resize-observer] Suggest using weak references (#6397)

ResizeObserver already uses weak references for observed elements. 

The leak in the examples is triggered by closure associated with the ResizeObserver callback function.
This is the cycle demonstrated in the bug:

```javascript
el => ResizeObserver
ResizeObserver => callback
callback => closure
closure => el
```

In Chrome, RO is kept alive by:
- direct JS refence, or
- at least one observed element (if element get garbage collected, it is automatically unobserved).


-- 
GitHub Notification of comment by atotic
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/6397#issuecomment-865301112 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Monday, 21 June 2021 19:53:17 UTC