remove stray comma separator in injected CSS declarations

This commit is contained in:
gorhill 2016-06-29 18:12:21 -04:00
parent 3752ac4880
commit 87d0cce9b2
2 changed files with 5 additions and 1 deletions

View File

@ -209,7 +209,7 @@ vAPI.domFilterer = {
if ( this.newCSSRules.length ) {
styleTag = document.createElement('style');
styleTag.setAttribute('type', 'text/css');
styleTag.textContent = ':root ' + this.newCSSRules.join(',\n:root ');
styleTag.textContent = ':root ' + this.newCSSRules.join('\n:root ');
document.head.appendChild(styleTag);
this.styleTags.push(styleTag);
this.newCSSRules.length = 0;

View File

@ -388,6 +388,10 @@ FilterParser.prototype.translateAdguardCSSInjectionFilter = function(raw) {
if ( matches === null ) {
return '';
}
// For now we do not allow generic CSS injections (prolly never).
if ( matches[1] === '' && matches[2] !== '@' ) {
return '';
}
return matches[1] +
'#' + matches[2] + '#' +
matches[3].trim() +