mirror of https://github.com/gorhill/uBlock.git
Ignore compilation hints when applying exception cosmetic filters
Related issue: - https://github.com/uBlockOrigin/uBlock-issues/issues/2475
This commit is contained in:
parent
6eec497ae8
commit
bc19a93815
|
@ -682,8 +682,7 @@ FilterContainer.prototype.disableSurveyor = function(details) {
|
|||
|
||||
/******************************************************************************/
|
||||
|
||||
FilterContainer.prototype.cssRuleFromProcedural = function(json) {
|
||||
const pfilter = JSON.parse(json);
|
||||
FilterContainer.prototype.cssRuleFromProcedural = function(pfilter) {
|
||||
if ( pfilter.cssable !== true ) { return; }
|
||||
const { tasks, action } = pfilter;
|
||||
let mq;
|
||||
|
@ -839,15 +838,13 @@ FilterContainer.prototype.retrieveSpecificSelectors = function(
|
|||
2
|
||||
);
|
||||
|
||||
// Apply exceptions to specific filterset
|
||||
if ( exceptionSet.size !== 0 ) {
|
||||
out.exceptionFilters = Array.from(exceptionSet);
|
||||
for ( const exception of exceptionSet ) {
|
||||
if (
|
||||
specificSet.delete(exception) ||
|
||||
proceduralSet.delete(exception)
|
||||
) {
|
||||
out.exceptedFilters.push(exception);
|
||||
}
|
||||
for ( const selector of specificSet ) {
|
||||
if ( exceptionSet.has(selector) === false ) { continue; }
|
||||
specificSet.delete(selector);
|
||||
out.exceptedFilters.push(selector);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -857,11 +854,18 @@ FilterContainer.prototype.retrieveSpecificSelectors = function(
|
|||
);
|
||||
}
|
||||
|
||||
// Some procedural filters are really declarative cosmetic filters, so
|
||||
// we extract and inject them immediately.
|
||||
// Apply exceptions to procedural filterset.
|
||||
// Also, some procedural filters are really declarative cosmetic
|
||||
// filters, so we extract and inject them immediately.
|
||||
if ( proceduralSet.size !== 0 ) {
|
||||
for ( const json of proceduralSet ) {
|
||||
const cssRule = this.cssRuleFromProcedural(json);
|
||||
const pfilter = JSON.parse(json);
|
||||
if ( exceptionSet.has(pfilter.raw) ) {
|
||||
proceduralSet.delete(json);
|
||||
out.exceptedFilters.push(pfilter.raw);
|
||||
continue;
|
||||
}
|
||||
const cssRule = this.cssRuleFromProcedural(pfilter);
|
||||
if ( cssRule === undefined ) { continue; }
|
||||
injectedCSS.push(cssRule);
|
||||
proceduralSet.delete(json);
|
||||
|
|
|
@ -2982,7 +2982,7 @@ class ExtSelectorCompiler {
|
|||
if ( hasArgs ) {
|
||||
const arg = this.astSerialize(part.args);
|
||||
if ( typeof arg !== 'string' ) { return; }
|
||||
out.push(`(${arg})`);
|
||||
out.push(`(${arg.trim()})`);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -3101,7 +3101,7 @@ class ExtSelectorCompiler {
|
|||
}
|
||||
if ( tasks.length === 0 && out.action === undefined ) {
|
||||
if ( prelude.length === 0 ) { return; }
|
||||
return prelude.join('');
|
||||
return prelude.join('').trim();
|
||||
}
|
||||
if ( prelude.length !== 0 ) {
|
||||
tasks.push(this.createSpathTask(prelude.join('')));
|
||||
|
|
Loading…
Reference in New Issue