Hrm, that's unfortunate. In the context of invalidation, we pretend these indexed selectors always match, so that the invalidation machinery just marks them for invalidation without doing expensive indexing math (At the cost of over-invalidation). We account for `:not` by flipping the result so that it returns `True` in the context outside of that negation. The problem is of course there being another negation, which flips the result to `False` and we skip invalidating it. For these selectors, we need `:not(:not(<...>:first-of-type<..>))` to return matching regardless of the depth of nesting. This sliped through because we only do matching with potential unknown results when we [move on invalidating from an inner selector to an outer selector](https://searchfox.org/mozilla-central/rev/dfc3050503739883ce6d17e8365bc35410106aba/servo/components/style/invalidation/element/state_and_attributes.rs#220) e.g. In `.foo :is(.bar .baz) .baa:first-of-type`, we invalidate on `.bar` class change down to `.baz`, then check to see if the outer selector's matching result changes.
Bug 1926164 Comment 8 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
Hrm, that's unfortunate. In the context of invalidation, we pretend these indexed selectors always match, so that the invalidation machinery just marks them for invalidation without doing expensive indexing math (At the cost of over-invalidation). We account for `:not` by flipping the result so that it returns `True` in the context outside of that negation. The problem is of course there being another negation, which flips the result to `False` and we skip invalidating it. For these selectors, we need `:not(:not(<...>:first-of-type<..>))` to return matching regardless of the depth of nesting. This sliped through because we only do matching with potential unknown results when we [move on invalidating from an inner selector to an outer selector](https://searchfox.org/mozilla-central/rev/dfc3050503739883ce6d17e8365bc35410106aba/servo/components/style/invalidation/element/state_and_attributes.rs#220) e.g. In `.foo :is(.bar .baz) .baa:first-of-type`, we invalidate on `.bar` class change down to `.baz`, then check to see if the outer selector's matching result changes. EDIT: Whoops, I put one too many `:not` there to make it work. Basically, nesting odd numbers of `:not` will make it work, even numbers will not.