You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We're redoing our :has() implementation due to #7676 and #7344 and I hit this case:
div, x:has(:is(:has(:foo))) { background: red }
div, x:has(:is(:has(div))) { background: red }
I'm not sure which of these statements is true
Both selectors are valid; although :has(:foo) and nested :has() are invalid, the forgiving nature of :is() means it's ignored.
The first selector is valid, because the inner :has() is invalid so it's ignored. The second is invalid; it's a nested :has()
Both selectors are invalid; there's a nested :has()
Safari goes for option 1, Chrome is option 3, and I think it should probably be option 2 - the forgiving nature of :is() seems like it should take priority to me.
As currently written, the spec requires the inner:has() to be the one that's invalid. The outer :has() just provides a parsing context that causes the invalidity; it doesn't care, itself, about why something is invalid inside of it. (And avoiding this sort of inconsistency is why the spec is written as it is, rather than invalidating the outer :has().)
So in both cases, the selectors are valid, but the :is() discards its arguments due to the nested :has() being invalid. So your option 1 is correct.
We're redoing our
:has()
implementation due to #7676 and #7344 and I hit this case:I'm not sure which of these statements is true
:has(:foo)
and nested:has()
are invalid, the forgiving nature of:is()
means it's ignored.:has()
is invalid so it's ignored. The second is invalid; it's a nested:has()
:has()
Safari goes for option 1, Chrome is option 3, and I think it should probably be option 2 - the forgiving nature of
:is()
seems like it should take priority to me.Testcase at https://jsbin.com/roxukig/edit?html,output
The text was updated successfully, but these errors were encountered: