Re: [WICG/webcomponents] custom pseudo elements like ::before ::after, but using custom elements (Issue #983)

While the idea is good, I agree with @rniwa, it is not a duplicate of the proposal, but it solves the same problem, by exposing the custom element using `::part` 

In your `<my-mesh-style>` example when setting element with part

```HTML
<phong-material part="phong"></phong-material>
<sphere-geometry part="sphere"></sphere-geometry>
```

you can apply css directly with 

```CSS
my-mesh-style::part(phong) {
  --material-color: red;
}

my-mesh-style::part(phong) {
  --wireframe: enable;
}
```
you can then replace with more specific styles

Another thing about pseudo elements `::before`/`::after`, they are additional visual only elements, they have no logic, meaning they are not interactable (afaik, any form of interaction is propagated to the element containing the pseudo one), and I feel that custom element we will want some logic that we expect to happen when we use it (e.g. user interacton), however that becomes something out of scope of style sheets.


Also, there is a positioning issue `::before` is a pseudo element positioned before the element and `::after` to be after it, how would we handle it with your proposal
 

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

Message ID: <WICG/webcomponents/issues/983/1437365653@github.com>

Received on Monday, 20 February 2023 17:46:05 UTC