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

Add pseudo-class after ::part() #255

Open
wants to merge 2 commits into
base: gh-pages
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 58 additions & 1 deletion tests/css-shadow-parts-1.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,64 @@ export default {
tr: '#part',
dev: '#part',
},
tests: ['::part(label)'],
tests: [
'::part(label)',
'::part(mypart):active',
'::part(mypart):any-link',
'::part(mypart):autofill',
'::part(mypart):checked',
'::part(mypart):closed',
'::part(mypart):default',
'::part(mypart):defined',
'::part(mypart):dir(ltr)',
'::part(mypart):disabled',
'::part(mypart):enabled',
'::part(mypart):focus',
'::part(mypart):focus-visible',
'::part(mypart):focus-within',
'::part(mypart):fullscreen',
'::part(mypart):future',
'::part(mypart):hover',
'::part(mypart):indeterminate',
'::part(mypart):in-range',
'::part(mypart):invalid',
'::part(mypart):lang(en)',
'::part(mypart):link',
'::part(mypart):modal',
'::part(mypart):open',
'::part(mypart):optional',
'::part(mypart):out-of-range',
'::part(mypart):past',
'::part(mypart):paused',
'::part(mypart):picture-in-picture',
'::part(mypart):placeholder-shown',
'::part(mypart):playing',
'::part(mypart):popover-open',
'::part(mypart):read-only',
'::part(mypart):read-write',
'::part(mypart):required',
'::part(mypart):state(mystate)',
'::part(mypart):target',
'::part(mypart):user-invalid',
'::part(mypart):user-valid',
'::part(mypart):valid',
'::part(mypart):visited',
'::part(mypart):xr-overlay',

'::part(mypart):target-within',
'::part(mypart):local-link',
'::part(mypart):seeking',
'::part(mypart):buffering',
'::part(mypart):stalled',
'::part(mypart):muted',
'::part(mypart):volume-locked',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dbaron I noticed that these are not currently added to the tests in Blink Cl, are these valid?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's in the spec for the selectors:
https://drafts.csswg.org/selectors-4/#sound-state

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I interpret them, :seeking, :buffering, :stalled, :muted, and :volume-locked fulfill the criteria for being placed after ::part(), as they match <audio> and <video> elements based on their local element information. (And David at least already added :paused and :playing.)

:current (and its functional notation), :future, and :past on the other side, not, because they are structural pseudo-classes, i.e. they match an element based on another element.

Copy link
Contributor Author

@yisibl yisibl Sep 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:future, and :past on the other side, not, because they are structural pseudo-classes, i.e. they match an element based on another element.

Can you go here and make a comment? w3c/csswg-drafts#10787


// Spec: https://drafts.csswg.org/css-view-transitions-2/#pseudo-classes-for-selective-vt
'::part(mypart):active-view-transition',
'::part(mypart):active-view-transition-type(mytype)',

// TODO: add pseudo-elements after ::part()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

],
},
},
interfaces: {
Expand Down