Re: [w3c/webcomponents] observedStyles (#856)

Apologies for this copy and paste, but I'm on my phone and this would be hard to rewrite. This is a comment of mine from another discussion on style observers, where there was a concern about their performance:




> I think that's a pretty huge benefit when designing custom elements. Built-in elements are able to perform work when CSS properties change, high-fidelity custom elements should be able to as well.
> 
> Take background-image and url() as an example. There's native code that fetches the image solely in response to the CSS property.
> 
> One big downside to not having observable CSS properties is that these type of style-related parameters can't be changed by changing a stylesheet, which means that some theming/customization for components has to happen at the JS level, which might not be accessible from those trying to do the theming...
> 
> I would be happy with a very limited form of style observation. Something where you have to specify the properties, they can only be custom properties, and you can only listen on shadow roots (maybe via ElementInternals?), and that changes to observed properties on the same element from within an observer are notified on the next frame - to try to ensure that any style changes as a result of observation don't lead to runaway cycles.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/webcomponents/issues/856#issuecomment-557934054

Received on Sunday, 24 November 2019 22:21:14 UTC