Open mrobinson opened 2 years ago
This seems somewhat analogous to #6493:
<div id="test">test</div>
<script>
var ro1 = new ResizeObserver(() => {
console.log("ro1");
ro2.unobserve(test);
});
ro1.observe(test);
var ro2 = new ResizeObserver(() => {
console.log("ro2");
});
ro2.observe(test);
</script>
This should log both ro1
and ro2
, i.e. the ro2 callback is invoked even if it's no longer observing any element.
So I think that your testcase should be consistent with this, first determine the active observations, then broadcast them regardless of whether some callback does something that would have avoided some observation.
This seems somewhat analogous to #6493:
In this case, should the specification be updated to clarify this?
https://w3c.github.io/csswg-drafts/css-contain-2/#cv-notes states:
A
ResizeObsever
observation callback might change thecontent-visibility
and force layout of an element though. Consider the situation where that freshly-hidden element also has aResizeObsever
triggered by the same resize event. The question here is whether a web engine should trigger an observation callback for the freshly-hidden element.To me it seems like the specification implies that immediately after content is hidden it should stop receiving any
ResizeObserver
callbacks, but I believe that there could be multiple interpretations of the passage above.cc @emilio
A WPT test demonstrating the situation
```html