If the full :matches pseudoclass is indeed currently too difficult to
implement with sufficient perfomance (and I'm relatively convinced, though
I'm not at all knowledgeable of how the matching engine works in specific),
I suggest that we still look at a limited form of :matches.
In the absolute limit, have it accept a simple selector preceded by either >
or +, so that you can match against children and the following sibling.
Preferably, have it accept all combinators (including none, for full
descendant matching) as well (currently, this means just accepting ~ and
none). This would address a large majority of use-cases for this feature,
without hitting the full complexity of allowing an arbitrary selector in the
:matches.
As a minor side-benefit, this would also be forwards-compatible with a full
implementation of :matches, as a later revision would merely have to remove
the requirement that the selector be simple.
Would this proposal (either the minimum or preferred one) be all right for
performance?
~TJ