w3c / IntersectionObserver

Intersection Observer
https://www.w3.org/TR/intersection-observer/
Other
3.62k stars 531 forks source link

Specify lifetime of the targets of a IntersectionObserver instance #520

Open xeaone opened 7 months ago

xeaone commented 7 months ago

I have a question about the lifetime of the observed targets of an IntersectionObserver instance. If an instance of a IntersectionObserver exists and it observers multiple targets what happens to the targets removed from the DOM and do not have a reference. Will they get garbage collected and will any internal event listeners or references to the removed target be cleaned up or garbage collected?

These issues are similar but what's unclear to me is the observed targets and any internal impact by not explicitly calling unobserve on observed targets.