In https://bugs.webkit.org/show_bug.cgi?id=253943 I fixed invalidation issues with :has() selectors that have nested positional pseudo-class selectors (like :nth-child() and :first-child), by using style relation bits. A better solution suggested by Antti on the PR might be to generate new MatchElement/IsNegation values to represent the fact that class name changes need to be checked in both the "before change" and "after change" cases, and to look at the siblings of the element too.
<rdar://problem/115537332>