Raymond Hill 2018-12-14 15:25:18 -05:00
parent 932c13bfa0
commit 8f05a2f8d3
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
3 changed files with 11 additions and 1 deletions

View File

@ -487,6 +487,7 @@ vAPI.DOMFilterer = (function() {
[ ':matches-css', PSelectorMatchesCSSTask ],
[ ':matches-css-after', PSelectorMatchesCSSAfterTask ],
[ ':matches-css-before', PSelectorMatchesCSSBeforeTask ],
[ ':not', PSelectorIfNotTask ],
[ ':xpath', PSelectorXpathTask ]
]);
}

View File

@ -31,6 +31,9 @@
};
LogEntry.prototype.init = function(details) {
if ( details.tstamp === undefined ) {
details.tstamp = Date.now();
}
this.details = JSON.stringify(details);
};

View File

@ -159,6 +159,7 @@
'matches-css',
'matches-css-after',
'matches-css-before',
'not',
'xpath'
].join('|'),
')\\('
@ -209,6 +210,9 @@
};
var compileConditionalSelector = function(s) {
if ( isValidCSSSelector(s) ) {
return { selector: s, tasks: [] };
}
// https://github.com/AdguardTeam/ExtendedCss/issues/31#issuecomment-302391277
// Prepend `:scope ` if needed.
if ( reNeedScope.test(s) ) {
@ -241,6 +245,7 @@
[ ':matches-css', compileCSSDeclaration ],
[ ':matches-css-after', compileCSSDeclaration ],
[ ':matches-css-before', compileCSSDeclaration ],
[ ':not', compileConditionalSelector ],
[ ':xpath', compileXpathExpression ]
]);
@ -293,7 +298,8 @@
raw.push(':has', '(', decompile(task[1]), ')');
break;
case ':if-not':
raw.push(task[0], '(', decompile(task[1]), ')');
case ':not':
raw.push(':not', '(', decompile(task[1]), ')');
break;
}
}