Re: [csswg-drafts] [selectors][mediaqueries] :media() pseudo-class as a shortcut for one-off media queries (#6247)

> Pseudo-classes are query something about the element, 

My point is that the *semantics* of a pseudo-class (any selector, really) is "filter the currently-matched set of elements according to condition X". The fact that `:media()`'s condition isn't element-specific doesn't change this, it just makes it feel a little funny. (We could always define that the pseudo-class only matches on the root element, to make it feel more "global", but I think that would make things unnecessarily annoying in practice.)

Conditional rules, on the other hand, either match or not, and activate or deactivate the rules inside of them. They haven't previously had any effect on the set of matched elements. Obviously we could add this, changing their pattern of behavior, but it would be a fairly significant change. We could no longer imagine conditional rules as "turning off" rules, but rather as a type of selector in itself that filters the set of matched elements.

(Also a nit: putting selector syntax nakedly into MQ syntax would be a no-go; the grammar is too wide and would force us to be very careful evolving both selectors and MQs in the future. But a `selector()` function would work.)

-- 
GitHub Notification of comment by tabatkins
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/6247#issuecomment-1256711928 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Friday, 23 September 2022 21:52:42 UTC