w3c / csswg-drafts

CSS Working Group Editor Drafts
https://drafts.csswg.org/
Other
4.44k stars 657 forks source link

[css-pseudo] Should ::before / ::after really be part-like? #10846

Open emilio opened 2 weeks ago

emilio commented 2 weeks ago

When @tabatkins introduced part-like pseudos in the spec (0f41712965), it was added that:

Both ::before and ::after are part-like pseudo-elements; there is no restriction on what properties apply to them.

While it is true that there are no property restrictions on these pseudos, I'm not sure they should be part-like pseudo-elements.

part-like pseudo-elements should have other properties (like supporting further pseudos, or a bunch of pseudo-classes that ::before and ::after do not support).

So I'm not convinced ::before and ::after should be marked as such?

emilio commented 2 weeks ago

cc @dbaron

dbaron commented 2 weeks ago

I'm inclined to agree although I'm not sure yet. I was expecting to look into this as part of the "audit" I suggested in #10794.

dbaron commented 2 weeks ago

I think making ::before and :after part-like means that ::before::before should work. Supporting potentially infinite levels of ::before/::after seems like it might be problematic. (Though maybe not?)

Loirooriol commented 2 weeks ago

Note that ::before::marker works (well, browsers don't support the selector yet, but the ::before can originate a marker box).

tabatkins commented 2 weeks ago

Hm, I'm fine either way.