Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
emilio opened this issue Sep 6, 2024 · 8 comments
Open

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

emilio opened this issue Sep 6, 2024 · 8 comments
Labels

Comments

@emilio
Copy link
Collaborator

emilio commented Sep 6, 2024

When @tabatkins introduced part-like pseudos in the spec (0f41712), 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
Copy link
Collaborator Author

emilio commented Sep 6, 2024

cc @dbaron

@dbaron
Copy link
Member

dbaron commented Sep 6, 2024

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
Copy link
Member

dbaron commented Sep 6, 2024

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
Copy link
Contributor

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

@tabatkins
Copy link
Member

Hm, I'm fine either way.

@josepharhar
Copy link
Contributor

I thought that part-like means that the main/parent element of the pseudo-element has a UA shadowroot, and there is an element in that shadowroot which the pseudo-element points to, but based on this discussion I guess that's not true, thats just how its implemented in blink.

@kbabbitt
Copy link
Contributor

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

FWIW, the spec currently states this is invalid. https://drafts.csswg.org/selectors-4/#sub-pseudo-elements:

Unless the corresponding sub-pseudo-element is explicitly defined to exist in another specification, pseudo-element selectors are not valid when compounded to another pseudo-element selector. So, for example, ::before::before is an invalid selector, but ::before::marker is valid (in implementations that support the ::before::marker sub-pseudo-element).

@css-meeting-bot
Copy link
Member

The CSS Working Group just discussed [css-pseudo] Should ::before / ::after really be part-like?, and agreed to the following:

  • RESOLVED: ::before and ::after are not ::part-like but are tree-abiding
The full IRC log of that discussion <dholbert> dbaron: this is a subtopic of previous one. emilio filed a specific issue about ::Before and ::after
<dholbert> dbaron: I agree with him, that ::before and after are not part-like
<kbabbitt> +1
<dholbert> fantasai: right, it surprised me to find that in the spec
<dholbert> emilio: sounds good
<andreubotella> +1
<dholbert> PROPOSED RESOLUTION: ::before and ::after are not ::part-like
<kbabbitt> q+
<flackr> +1
<Rossen6> ack flackr
<Rossen6> ack fantasai
<Rossen6> ack kbabbitt
<dholbert> kbabbitt: but they are tree-abiding?
<dholbert> emilio: right
<dholbert> PROPOSED RESOLUTION: ::before and ::after are not ::part-like but are tree-abiding
<dholbert> RESOLVED: ::before and ::after are not ::part-like but are tree-abiding

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Friday afternoon
Development

No branches or pull requests

8 participants