mirror of
https://github.com/gorhill/uBlock.git
synced 2026-03-11 09:04:36 +00:00
Improve parse-properties-to-match scriptlet helper
Related issue: https://github.com/uBlockOrigin/uBlock-discussions/discussions/831#discussioncomment-11637436 If the property name contains unexpected characters, assume that the `:` is not a separator.
This commit is contained in:
parent
89e44131a0
commit
7494eaf621
1 changed files with 5 additions and 1 deletions
|
|
@ -598,8 +598,12 @@ function parsePropertiesToMatch(propsToMatch, implicit = '') {
|
|||
if ( propsToMatch === undefined || propsToMatch === '' ) { return needles; }
|
||||
const options = { canNegate: true };
|
||||
for ( const needle of safe.String_split.call(propsToMatch, /\s+/) ) {
|
||||
const [ prop, pattern ] = safe.String_split.call(needle, ':');
|
||||
let [ prop, pattern ] = safe.String_split.call(needle, ':');
|
||||
if ( prop === '' ) { continue; }
|
||||
if ( pattern !== undefined && /[^$\w -]/.test(prop) ) {
|
||||
prop = `${prop}:${pattern}`;
|
||||
pattern = undefined;
|
||||
}
|
||||
if ( pattern !== undefined ) {
|
||||
needles.set(prop, safe.initPattern(pattern, options));
|
||||
} else if ( implicit !== '' ) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue