mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-11 09:31:01 +01:00
Fix logger's reverse-lookup of selectors with no \w
characters
Related issue: - https://github.com/uBlockOrigin/uBlock-issues/issues/1139
This commit is contained in:
parent
941898e54e
commit
d1715fb19f
1 changed files with 3 additions and 1 deletions
|
@ -124,7 +124,9 @@ const fromCosmeticFilter = function(details) {
|
||||||
const hostname = details.hostname;
|
const hostname = details.hostname;
|
||||||
|
|
||||||
// The longer the needle, the lower the number of false positives.
|
// The longer the needle, the lower the number of false positives.
|
||||||
const needle = selector.match(/\w+/g).reduce(function(a, b) {
|
// https://github.com/uBlockOrigin/uBlock-issues/issues/1139
|
||||||
|
// Mind that there is no guarantee a selector has `\w` characters.
|
||||||
|
const needle = selector.match(/\w+|^.*$/g).reduce(function(a, b) {
|
||||||
return a.length > b.length ? a : b;
|
return a.length > b.length ? a : b;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue