Re: [csswg-drafts] [resize-observer] ResizeObserver is too slow to be useful but required to be correct (#9560)

> Compare to this animation which looking up the size to make the canvas via `element.clientWidth` and `element.clientHeight`

These are not observers. What do you use to track changes on clientWidth/clientHeight?

Using `ResizeObserver` should be slower than `requestAnimationFrame`, but faster than 2 rAFs:

```js
new ResizeObserver(() => console.log('ResizeObserver')).observe(document.body);
requestAnimationFrame(() => {
    console.log('requestAnimationFrame 1');
    requestAnimationFrame(() => console.log('requestAnimationFrame 2'));
});
```
```
requestAnimationFrame 1
ResizeObserver
requestAnimationFrame 2
```

That should be quite fast. So hard to say since you don't provide a testcase, but seems a bug in your browser or your code.

Anyways, the timing of this is part of HTML, not CSS: https://html.spec.whatwg.org/multipage/webappapis.html#update-the-rendering





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


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

Received on Monday, 13 November 2023 12:04:35 UTC