1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-09-15 07:22:28 +02:00

Fix logic mistake in last commit

Related commit:
- 6d935c8925

Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/756
This commit is contained in:
Raymond Hill 2019-11-02 11:45:18 -04:00
parent 72837c9bda
commit 4afc0764d2
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2

View File

@ -87,19 +87,19 @@
const matched = new Set();
if ( simpleStr !== '') {
for ( const node of candidates ) {
if ( Date.now() > tMax ) { return -1; }
if ( node.matches(simpleStr) === false ) { continue; }
candidates.delete(node);
matched.add(node);
if ( matched.size === 99 ) { break; }
if ( Date.now() > tMax ) { return -1; }
}
}
if ( matched.size < 99 && complexStr !== '') {
for ( const node of candidates ) {
if ( Date.now() > tMax ) { return -1; }
if ( node.closest(complexStr) !== node ) { continue; }
matched.add(node);
if ( matched.size === 99 ) { break; }
if ( Date.now() > tMax ) { return -1; }
}
}
return matched.size;