Re: [csswg-drafts] [resize-observer] Add option to skip firing on observe (#12608)

The "first" call itself isn’t the problem - it’s the subsequent calls to `observe()` that are.

For example, suppose I want to monitor the width of a stretched element when the browser window is resized, but I also allow the user to set the element’s height explicitly. When the user sets the height (which I already know about), I don’t need a `ResizeObserver` notification. So before applying the height, I call `unobserve()`, and afterward I call `observe()` again. The issue is that re-observing immediately triggers a callback, even though nothing has changed. I can work around this by adding extra logic to ignore that first call, but I don’t see why it should be mandatory for the callback to fire on `observe()` when no change has occurred. A boolean option to suppress the initial callback would remove the need for this extra handling.

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


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

Received on Friday, 15 August 2025 11:19:25 UTC