Re: [csswg-drafts] [cssom] `ComputedStyleObserver` to observe changes in elements' computed styles (#8982)

+1 for this proposal.
Let me give some detail about why we need this.
Currently we're working on a cross-platform rendering infra(like react-native). Developers using CSS syntax to define layout of the DOMs.
However, we provided some non-standard CSS properties for developers, since it's will gain some performance improvement on iOS/Android.
The way we implement it on Web platform is that we transform the `some-property:custom-value` to `--some-property:custom-layout` on compile-time, and use `getComputedStyle()` in `attributeChangedCallback` to get the value of the css variables, then use Javascript to do somethings.
As you can see, here we could only observe on `style` and `class` attribute change, which means our handler will be called frequently(it' expensive since we have to `getComputedStyle` every time);
It will be really helpful if there is a way to observe specified CSS properties.


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


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

Received on Friday, 17 May 2024 13:39:14 UTC