Surely there is more to it than that. What am I missing?
Surely there is more to it than that. What am I missing?
This is great not just to understand more about what’s happening when browser-specific stuff goes sideways, it’s also a really good place to take design inspiration for encapsulating your own stuff. Besides scoping styles and fully isolating children as implementation details, the native implementations often make judicious use of `part` and `slot` aspects of the relevant/related APIs to handle interop with the non-encapsulated parts of their interface. In a lot of ways this allows elements (both native and custom) to provide much stronger contracts than the mostly tag soup that HTML tends to be by default. And it’s especially great that the interface for this is largely (if not totally now?) how built in behavior works, so writing code that targets the browser has the same privileges and the same limitations as the equivalent code the browser provides.
https://developer.chrome.com/blog/a-new-experimental-feature...
My outstanding question here is: how do people reuse components across sites with different themes? Do they have to pass styles across the shadow boundary via JS? Or do they just give up on cross-project reuse or theming?
This is the proposal for scoped elements: https://github.com/WICG/webcomponents/blob/gh-pages/proposal...
It appears custom CSS properties pierce through as well. https://open-wc.org/guides/knowledge/styling/styles-piercing...
It might have been fixed recently, have a look.