Re: [csswg-drafts] [selectors-4] Add pseudo-class to establish before-change style for css-transitions on new elements. (#8174)

> ok but:
> 
> ```
> h1, h2 {
>  &.test:hover {
>    color: red;
>  }
> }
> 
> h1:hover, h2:hover {
>  &.test {
>    color: red;
>  }
> }
> ```
> 
> will both work but with :initial
> 
> ```
> h1, h2 {
>  &.test:initial{
>    color: red;
>  }
> }
> 
> h1:initial, h2:initial {
>  &.test {
>    color: red;
>  }
> }
> ```
> 
> first will work but second will not right? Just pointing out as nesting is not clear to some as it is with it wrapping things in :is() sometimes.

Yes, that is correct.

We previously resolved that specificity of matches-any selectors should not depend on matching in https://github.com/w3c/csswg-drafts/issues/1027#issuecomment-393236516

Having to continue matching to find out if :initial matches inside matches-any selectors is a very similar thing, even though we could stop once we have matched at least one :initial selector.

I think the examples above shows it works in the most important use-cases, but it can certainly be surprising to authors when it doesn't work.


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


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

Received on Thursday, 16 February 2023 08:54:46 UTC