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

> but it solves the same problem, by exposing the custom element using `::part`

That's a different scenario than I've outlined. I'm saying we have markup something like this:

```html
<mesh-3d></mesh-3d>
```

Now, I need to _style_ it _**as if**_ I had written this:

```html
<mesh-3d>
  <phong-material ...></phong-material>
  <box-geometry ...></box-geometry>
</mesh-3d>
```

_**Or as if**_ I had written this:

```html
<mesh-3d>
  <physical-material ...></physical-material>
  <sphere-geometry ...></sphere-geometry>
</mesh-3d>
```

without actually having changed the original `<mesh-3d></mesh-3d>` DOM. 

This is not about which elements are known to be inside a ShadowRoot.

See, totally different than `::part`! And similar to `::before`/`::after`.



> I feel that custom element we will want some logic that we expect to happen when we use it (e.g. user interacton),

Yeah, true. Maybe it would be doable? Or maybe interaction would be disabled (f.e. dispatchEvent would throw if called on such an element), otherwise built in events won't be triggered by it. Maybe interactions do only happen on the DOM host. Maybe `dispatchEvent` dispatches from the DOM host. Perhaps we can make rules.




> 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?

perhaps it can be solved like

```html
mesh-3d::element-before("<physical-material ...>") {
  /*...*/
}
mesh-3d::element-after("<box-geometry ...>") {
  /*...*/
}
```

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

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

Received on Thursday, 23 February 2023 08:46:27 UTC