- From: Jouni Koivuviita <notifications@github.com>
- Date: Wed, 29 Jan 2020 05:04:47 -0800
- To: w3c/webcomponents <webcomponents@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Wednesday, 29 January 2020 13:04:49 UTC
> It looks like a hack to 'select' elements though a shadow root? Yes, it is. I was mainly looking at a workaround with a syntax that browsers currently parse as valid CSS so that the styles can be accessed through the DOM API, and not resort to parsing strings with regular expressions. Another alternative I played with was `@namespace`. You can abuse that similarly, that selectors are parsed by the browser but not applied to elements automatically. Then you can traverse the style sheets through the DOM API and pick up the styles you want to apply to your component. --- > Using `@` rules is an interesting idea. The one problem I see with that approach is that users of components can defile an arbitrary list of selectors. How does component define which elements' styles can be overridden, and which one can't be? Yeah, that’s a problem for sure, and probably a big enough to discard the idea of using `@`-rules. I assume it’s a bad idea to only parse `::part` and `:state` selectors inside such `@`-rules? It’s kinda like `::shadow` and `/deep/` all over again. For example: ```css @shadow my-component { ::part(foobar) { ... } } ``` -- 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/864#issuecomment-579746175
Received on Wednesday, 29 January 2020 13:04:49 UTC