AdguardTeam / FiltersCompiler

A tool that compiles & validates filters
GNU Lesser General Public License v3.0
52 stars 12 forks source link

The rules with escaped characterd are marked as invalid #55

Closed Alex-302 closed 4 years ago

Alex-302 commented 5 years ago
Invalid rule: better.com#$##header-floating\ navbar { position: absolute !important; } incorrect style: #header-floating\ navbar { position: absolute !important; }
Invalid rule: bongino.com#$##site-header\ 1 > .site-header-main { height: 167.3px !important; } incorrect style: #site-header\ 1 > .site-header-main { height: 167.3px !important; }
Invalid rule: deadline.com#$#.pmc-u-background-white.\/\/.header__bar { position: relative !important; transform: translateY(0) !important; } incorrect style: .pmc-u-background-white.\/\/.header__bar { position: relative !important; transform: translateY(0) !important; }
Invalid rule: engadget.com#$#.o-sticky_header\@tp- { position: relative !important; } incorrect style: .o-sticky_header\@tp- { position: relative !important; }
Invalid rule: sports.yahoo.com#$##atomic .Mt\(headerHeight\) { margin-top: 22px !important; } incorrect style: #atomic .Mt\(headerHeight\) { margin-top: 22px !important; }
Invalid rule: texasmonthly.com#$##\#novella-header { position: relative !important; top: 0 !important; } incorrect style: #\#novella-header { position: relative !important; top: 0 !important; }
Invalid rule: theculturetrip.com#$#.header-menu\.styled__HeaderMenu-s8ctnhx-0.flipboard-remove { position: absolute !important; } incorrect style: .header-menu\.styled__HeaderMenu-s8ctnhx-0.flipboard-remove { position: absolute !important; }
Invalid rule: thedeepmag.ca#$##\#novella-header { position: absolute !important; top: 0 !important; } incorrect style: #\#novella-header { position: absolute !important; top: 0 !important; }
Invalid rule: thenation.com#$##\'navbar\' { position: relative !important; height: 130px !important; } incorrect style: #\'navbar\' { position: relative !important; height: 130px !important; }
Invalid rule: yahoo.com#$##atomic, #Navigation, #UH-0-Header, #UH-1-NavLite, #UH, #UH-0-SportsUH-0-Header, #UH-1-DesktopNav, #YDC-SecondaryNav, #YDC-UH-Stack, .Pos\(f\)\!, .Mb-0.Zoom-1.header.js-applet.M-0, .action-bar, .y-header, .yui-sv-hd.ct-box-hd { position: relative !important; top: 0 !important; transform: none !important; box-shadow: none !important; } incorrect style: #atomic, #Navigation, #UH-0-Header, #UH-1-NavLite, #UH, #UH-0-SportsUH-0-Header, #UH-1-DesktopNav, #YDC-SecondaryNav, #YDC-UH-Stack, .Pos\(f\)\!, .Mb-0.Zoom-1.header.js-applet.M-0, .action-bar, .y-header, .yui-sv-hd.ct-box-hd { position: relative !important; top: 0 !important; transform: none !important; box-shadow: none !important; }
Invalid rule: yahoo.com#$#.HideBottomBar .HideBottomBar_Mt\(-35px\), .Trs\(subnavTransition\).T\(0\).UhHideSubnav_Mt\(-50px\) { margin-top: 0 !important; } incorrect style: .HideBottomBar .HideBottomBar_Mt\(-35px\), .Trs\(subnavTransition\).T\(0\).UhHideSubnav_Mt\(-50px\) { margin-top: 0 !important; }
Invalid rule: yahoo.com#$#.HideBottomBar .HideBottomBar_Op\(0\) { opacity: 1 !important; } incorrect style: .HideBottomBar .HideBottomBar_Op\(0\) { opacity: 1 !important; }

Invalid rule: engadget.com#$#.o-sticky_header\@tp- { position: relative !important; } incorrect style: .o-sticky_header\@tp- { position: relative !important; } image

Mizzick commented 4 years ago

By design, take a look #47

AdamWr commented 4 years ago

Shouldn't it be applied only to this part which is in curly brackets { ... }? If I'm not wrong, at the moment we can't add CSS rules with regex in :matches-css, like mentioned here - https://github.com/AdguardTeam/FiltersCompiler/issues/49#issue-472488980 due to this limitation.

ameshkov commented 4 years ago

Yep, I think @AdamWr is right. @tvinzz please take care of it

AdamWr commented 4 years ago

It seems that now some extended css rules are marked as invalid. For example:

! Incorrect style:
anidub.com#?#div[style^="background: url(\"https://online.anidub.com/templates/"] > div[id]:matches-css(height: 250px)

https://github.com/AdguardTeam/FiltersRegistry/blob/master/filters/filter_1_Russian/diff.txt

and

! Incorrect style:
yasehub.com#?#.video-list > ul > li.video-item:has(> div[class] > .video-thumb > .video-thumb-image[style^="background-image: url('https://static2.yaseok.com/uploads/"])
! Incorrect style:
~www.wp.pl,wp.pl#?#[class^="_"] > [class^="_"][class*=" _"]:has(>[class^="_"] > [class*="_"] > a[href] > [style*="background-image: url("])

https://github.com/AdguardTeam/FiltersRegistry/blob/master/filters/filter_2_English/diff.txt#L151-L154