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

Efforts to standardize the internal pseudo-elements aren't very successful, unfortunately.  I keep trying to get *something* done with that, but it's very difficult to do in a reasonable way.  I'm not confident that it will ever be achieved.

Mixins and Nesting are battle-tested concepts with long histories from CSS preprocessors; their mixture, especially, has a long history of use in Sass (and maybe more?).  These aren't new concepts, they're just *new to vanilla CSS*.  And they lean on existing useful and well-tested concepts from CSS, like inheritance and properties.

Custom pseudo-elements, on the other hand, don't.  We've had pseudo-elements for a long time, but only a small number, and they don't nest.  We still need to figure out how to solve a number of issues before it's usable:

1. Are shadow-pseudos more like classes or IDs? That is, do they need to be unique, or is it ok to have multiple selected by the same name?  If you can have multiple, how do we select a *single* one to style?  Does the component author have to allow this?  Can a single element expose multiple pseudo names for itself?

2. How do we handle both a parent and child exposing themselves as pseudo-elements? Is the nesting visible or not?  If yes, can you write `::foo::bar`?

3. (This one's important and hard.) If a component contains other components, and wants to expose some of its sub-components parts as pseudo-elements, how does it surface them?  Are they selectable by default somehow (if so, how do you handle namespacing)? If not, how do you expose them? Is it apparent that they come from a sub-component, or can the parent component make them look "native"?

All of these questions apply to vars/@apply/nesting too, but they all have definite, simple answers there, and those answers are imo reasonable behavior.  We have no idea what the answers would be for pseudo-elements, tho.

This is why it's backwards to characterize vars/@apply/nesting as "new and untested" and pseudo-elements as "old and well-known".  It's almost exactly the opposite when you dig into details.

---
Reply to this email directly or view it on GitHub:
https://github.com/w3c/webcomponents/issues/300#issuecomment-143880372

Received on Monday, 28 September 2015 21:39:35 UTC