:state() should be allowed after ::part()
Categories
(Core :: DOM: Core & HTML, enhancement)
Tracking
()
Tracking | Status | |
---|---|---|
firefox122 | --- | fixed |
People
(Reporter: mozilla, Assigned: mozilla)
References
()
Details
(Keywords: dev-doc-complete)
Attachments
(1 file)
Currently ::part(foo):state(bar)
is a parse failure.
Assignee | ||
Comment 1•1 year ago
|
||
Updated•1 year ago
|
Comment 2•1 year ago
|
||
I think that would be worth mentioning in the description of ::part
and in its browser compat data.
Do other browsers already support that?
Sebastian
Comment 5•1 year ago
|
||
bugherder |
Comment 7•10 months ago
•
|
||
MDN docs tracking for this is here https://github.com/orgs/mdn/projects/12/views/6?pane=issue&itemId=49800847
This states that FF122 supports :state()
after ::part()
, so from the proposal ElementInternals's states
property and the :state()
pseudo class we see stuff like this:
question-box::part(checkbox):state(checked) { color: green; }
But my understanding is that :state()
didn't make it to the Custom State Pseudo Class spec which uses the :--state_ident_name
syntax to select a state. So the above ended up being:
question-box::part(checkbox):--checked { color: green; }
So a few questions:
- Did
:state()
make it into the spec and I'm missing it? If not, presumably it should be removed from https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-classes ? - What was actually implemented by this PR - support for
part(ident)
:--state_ident_name
? - Docs cover the states in https://developer.mozilla.org/en-US/docs/Web/API/CustomStateSet#interaction_with_css (thinly) but don't mention
part()
. So presumably we need to add and example selecting against an identified part here too? - This change was FF122 right?
Assignee | ||
Comment 8•10 months ago
|
||
Did
:state()
make it into the spec and I'm missing it?
It went back and forth but ultimately the conclusion was to use :state()
. See related HTML spec PR: https://github.com/whatwg/html/pull/8467, MDN docs PR: https://github.com/mdn/content/pull/31258.
What was actually implemented by this PR - support for
part(ident)
:--state_ident_name
?
::part()
and :state()
are separate, and were implemented in separate issues/PRs. This issue/PR implemented the facility to parse & select for those selectors combined, e.g. ::part(foo):state(bar)
. Specifically, while :state()
parsing was handled in https://bugzilla.mozilla.org/show_bug.cgi?id=1861466, this bug and PR lifted the gate on allowing :state()
after ::part()
.
So presumably we need to add and example selecting against an identified part here too?
Sounds good to me.
This change was FF122 right?
I believe so.
Updated•9 months ago
|
Comment 9•9 months ago
|
||
FYI I've marked this as dev-docs-complete as the bulk of the work has been done and we're in late phase review/fixes. @keith - thanks so much for all the help, advice, and rework.
Description
•