w3c / csswg-drafts

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

[selectors-4] Should we have :open and :closed? #11039

Open josepharhar opened 1 week ago

josepharhar commented 1 week ago

It was resolved here to have both :open and :closed pseudo-classes: https://github.com/w3c/csswg-drafts/issues/7319#issuecomment-1276473056

@annevk mentioned here that :closed is redundant with :not(:open): https://github.com/WebKit/standards-positions/issues/413#issuecomment-2406663870

Here is the justification for having both of them: https://github.com/w3c/csswg-drafts/issues/7319#issuecomment-1242377579

Should we also talk about adding the corresponding :closed pseudo class? That would avoid the problem that :not(:open) can match anything, including things that don't open or close.

The HTML spec has not been merged yet: https://github.com/whatwg/html/pull/10126

annevk commented 1 week ago

Note in particular that the justification for :closed is no longer valid with the current HTML PR. We did not want to make :closed only match things that can be closed as this set of items might change over time.

tabatkins commented 1 week ago

Okay, if you purposely don't want to hook :closed to the "openability" of an element, then yeah, it's completely redundant with :not(:open) and we probably shouldn't add it.