W3C home > Mailing lists > Public > public-css-archive@w3.org > June 2020

[csswg-drafts] [resize-observer] Notification after element is no longer referenced (#5155)

From: jods via GitHub <sysbot+gh@w3.org>
Date: Wed, 03 Jun 2020 08:30:34 +0000
To: public-css-archive@w3.org
Message-ID: <issues.opened-629801636-1591173032-sysbot+gh@w3.org>
jods4 has just created a new issue for https://github.com/w3c/csswg-drafts:

== [resize-observer] Notification after element is no longer referenced ==
As far as I can tell, when the ResizeObserver repo was archived, issues were closed but not copied over 😞 

This is a copy of WICG/resize-observer#55 from @atotic 

It is an important issue because depending on the answer, not calling `disconnect` or `unobserve` could lead to memory leaks.

Original issue:


We need to clarify Object Lifetimes for ResizeObserver and Elements.

Current specification discusses states that:

> A ResizeObserver will remain alive until both of these conditions are met:
> - there are no scripting references to the observer.
> - the observer is not observing any targets.

The relationship whether RO has influence on Element object lifetime is not discussed.

Clarifying this is important in following corner case:
let el = document.querySelector("#id");
let ro = new ResizeObserver();
setTimeout( _ => { 
  el = null;
  // will there be any notifications after this timeout executes.
  // only remaining reference to el is inside RO.
Current Chrome code implicitly unobserves element if there are no JS references to it. This is not captured by the specification.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/5155 using your GitHub account
Received on Wednesday, 3 June 2020 08:30:37 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:42:09 UTC