Re: [csswg-drafts] [selectors] :visible / :hidden (#7489)

Yeah, we *can't* meaningfully limit the set of properties you can apply via a pseudo-class. Not only is it actually a completely distinct and more complicated subject due to what you're filtering by, it doesn't extend.

If you have pseudo-classes :foo and :bar that can have their matching affected by properties, so you prevent rules using :foo from setting property `foo` and rules using :bar from setting property `bar`, then there's nothing preventing you from setting `bar` in a :foo rule, then using a :bar rule to respond to that and set `foo`, thus giving us the cyclic behavior we were trying to avoid initially.  The end result of this is that we can't have separate lists of restricted properties, one per pseudo-class - we need a *single* list of properties that can affect *any* pseudo-class, and are restricted from being used in *any* property-affected pseudo-class. This not only becomes extremely restrict extremely quickly (you can't set `opacity`, `display`, etc since `:visible` would be affected by them), but it's not forward-compatible - if we added a new pseudo-class that needs to restrict an existing property, all *existing* rules with property-affected pseudo-classes that currently (validly) set that property would suddenly stop being able to do so.

So that idea is just permanently, unfixably dead in the water forever.  If you want selectors that can be affected by properties/layout, you *must* build them on the same model as `:hover` - the detection is "late" (after a full page style/layout has completed) and is allowed to be preempted from looping by the browser.

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


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

Received on Friday, 15 July 2022 17:40:47 UTC