Closed Bug 1866351 Opened 5 months ago Closed 5 months ago

:state() should be allowed after ::part()

Categories

(Core :: DOM: Core & HTML, enhancement)

enhancement

Tracking

()

RESOLVED FIXED
122 Branch
Tracking Status
firefox122 --- fixed

People

(Reporter: mozilla, Assigned: mozilla)

References

(Blocks 1 open bug, )

Details

(Keywords: dev-doc-complete)

Attachments

(1 file)

Currently ::part(foo):state(bar) is a parse failure.

Blocks: 1588763
Assignee: nobody → mozilla
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true

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

Pushed by mozilla@keithcirkel.co.uk:
https://hg.mozilla.org/integration/autoland/rev/cb26831dfc54
allow :state() after ::part() r=emilio
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/43490 for changes under testing/web-platform/tests
Status: ASSIGNED → RESOLVED
Closed: 5 months ago
Resolution: --- → FIXED
Target Milestone: --- → 122 Branch
Upstream PR merged by moz-wptsync-bot

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:

Flags: needinfo?(mozilla)

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.

Flags: needinfo?(mozilla)

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.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: