diff --git a/src/js/static-ext-filtering.js b/src/js/static-ext-filtering.js index 695f6e6da..51b31a6be 100644 --- a/src/js/static-ext-filtering.js +++ b/src/js/static-ext-filtering.js @@ -119,9 +119,16 @@ }; const translateAdguardCSSInjectionFilter = function(suffix) { - var matches = /^([^{]+)\{([^}]+)\}$/.exec(suffix); + const matches = /^([^{]+)\{([^}]+)\}$/.exec(suffix); if ( matches === null ) { return ''; } - return matches[1].trim() + ':style(' + matches[2].trim() + ')'; + const selector = matches[1].trim(); + const style = matches[2].trim(); + // For some reasons, many of Adguard's plain cosmetic filters are + // "disguised" as style-based cosmetic filters: convert such filters + // to plain cosmetic filters. + return /display\s*:\s*none\s*!important;?$/.test(style) + ? selector + : selector + ':style(' + style + ')'; }; const hostnamesFromPrefix = function(s) {