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
{{ message }}
Repository navigation
remove() and replaceAll() throw "Unknown Pseudo-Class: matches" for :matches() #123
The legacy selector engine, QueryPath\CSS\QueryPathEventHandler, does not recognise :matches(). It is still the engine behind remove() and replaceAll(), so those methods throw on a selector that find() accepts:
The exception is raised by the default branch of the pseudo-class switch in QueryPathEventHandler (src/CSS/QueryPathEventHandler.php, around line 637). CSS\DOMTraverser supports :matches(), so the two engines disagree.
Suggested fix
Add a matches case alongside not and has. :matches(X) keeps the candidates that match X, the complement of :not(X), so it can share that implementation. Worth considering :is() (the CSS Selectors 4 name for :matches()) at the same time, in both engines.
Activity
Select with DOMTraverser in remove() and replaceAll() (#127)