Re: [w3c/webcomponents] Support Custom Pseudo-elements (#300)

> (1) Style nit:

Yeah, in an actual spec I'd have dropped it down significantly - the references to previous solutions is there specifically to set up the proposal properly for this discussion.

(2) It seems like ::theme() is only useful for open mode shadow DOMs that have not done appropriate forwarding for further shadow DOMs that they contain. Is that really a big enough use case? The forwarding feature seems like a cleaner way to handle this, and one that also works with closed-mode shadow DOMs.

Yes, I believe it is important enough, for two reasons.  

1. One of the objections I heard from Polymer folk about dropping `@apply` for `::part()` was that is made it more difficult to style all the buttons on the page, or similar.  This was easy with `@apply` - just set `--button-styles: {...};` and you were good - unless someone in the chain explicitly blocks that property, every button in the subtree will receive the styling.

2. Related to the above, one of the justifications for this whole feature area (`@apply`, `::part()`, etc) is that you can already arbitrarily style things with custom properties, it's just awkward and dumb.  If we restrict to *just* explicit forwarding (via `::part()`), then people who want to allow arbitrary styling of their components can still get around the restriction by using the tons-of-properties approach. `::theme()` captures this use-case in a much better way.  (We might, of course, judge that this use-case is bad and people shouldn't do it, and so making it less terrible to use isn't worthwhile. Per the first reason, I don't think this is the case.)

> (3) It should be possible for components to restrict the set of CSS properties that can be applied to a part, ideally via a whitelist. (a) Built-in elements that expose pieces as pseudo-elements all do this; and (b) it seems likely that some CSS properties could break components in unexpected ways.

Maybe!  This is definitely something we can explore; it seems easily separable, meaning we don't necessarily have to have it in the v1 proposal.  I'm definitely okay with it, tho.  Maybe something like `part-properties="<comma-separated list>"`, where if it's missing or set to "*" it allows all of CSS.  

The authlist should only apply to normal CSS properties, I think - all custom props should be implicitly allowed. You can disallow them by setting them from within the component with an !important, I think.

-- 
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/300#issuecomment-277813594

Received on Monday, 6 February 2017 21:08:54 UTC