Skip to content

Commit 567ceb0

Browse files
committed
Add better performance when using :matches or :not
1 parent 942c24d commit 567ceb0

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

lib/pseudo.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,16 @@ function match(query, node, index, parent, state) {
8989
}
9090

9191
function matches(query, node, index, parent, state) {
92-
return Boolean(anything(query.value, node, state)[0])
92+
var one = state.one
93+
var result
94+
95+
state.one = true
96+
97+
result = Boolean(anything(query.value, node, state)[0])
98+
99+
state.one = one
100+
101+
return result
93102
}
94103

95104
function anyLink(query, node) {

0 commit comments

Comments
 (0)