AdguardTeam / AdguardTeam/AdguardBrowserExtension
Complex/Long rules of native :is() :has() are not working in Adguard, works fine in other Adblockers.
- Lenguaje dominante
- TypeScript
- Estrellas
- 4.4k
- Forks
- 449
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
### Please answer the following questions for yourself before submitting an issue
- [X] Filters were updated before reproducing an issue
- [X] I checked the [knowledge base](https://adguard.com/kb/) and found no answer
- [X] I checked to make sure that this issue has not already been filed
### AdGuard Extension version
4.3.53 (beta) / 0.4.50 (Experimental MV3)
### Browser version
1.68.61 Chromium: 126.0.6478.26 (Official Build) nightly (64-bit)
### OS version
Windows 11 Version 23H2 (Build 22631.3672)
### Ad Blocking
_No response_
### Privacy
_No response_
### Social
_No response_
### Annoyances
_No response_
### Security
_No response_
### Other
_No response_
### Language-specific
_No response_
### What Stealth Mode options do you have enabled?
_No response_
### Issue Details
Steps to reproduce:
1. add `twitch.tv##:is(.tw-tower > div, div:has(>[class*="search-result-card"]), .search-result-related-live-channels__row-container > :last-child > .tw-col):has([href])`
2. go to https://www.twitch.tv/directory/all
3. All channels should be hidden but they are not (this is because no channel href is specified to hide channels base on the channel's name, so applies to every channel)
4. Remove some parts of the rule like the :has() inside :is(), and it seems to work without issues, but that means the :has() rule has to be broken into an individual one for Adguard to work like other tested Adblockers.
### Expected Behavior
_No response_
### Actual Behavior
The rule is not being applied the browser gets weird like too slow because of the rule, if you remove the :is() and make them individual, the rules work and the browser feels fairly okay.
### Screenshots
Screenshot 1
### Additional Information
As you can see it is a very complex rule, but it is a completely fine and valid rule made with normal native Chromium features. There shouldn't be a reason why it is not working in Adguard.
And yes, I tested it and it works perfectly fine in other adblockers, Brave, uBlock and ABP which is MV3 complaint, so Devtools nor other adblockers have issues with it.
Why I started making these complex rules? because Brave doesn't support procedural filters at the moment, so I have to select channels to be hidden based on their attributes and since :has() is supported in Chromium browsers natively, it made it possible. I believe doing it with native selectors and not Procedurals is the way to go anyway, even if the rule is too complex, you don't get too much performance issues when hiding many channels compared to using the slower Procedural rules/non-native CSS selectors/pseudo-classes.
This rule is pretty much a native way of doing what 'unwanted twitch' extension does (an extension to 'block' channels based on tags, username and all that) but without the need of running the extension, especially on mobile where Chromium has no official extension support. I have been using it for a while, but seems to have issues only in Adguard when I wanted to see how my Brave custom rules worked in Adguard MV3, but noticed even the MV2 version has issues with it.
The reason for using `:is()` is because as you can see, without it, it rule has to be broken into 3 different rules, so it is better just to modify the href once and done.
But for example, the rule works by specifying a channel in the href attribute like `:has([href="/smitegame"])` and it will hide individual channels if you go to https://www.twitch.tv/directory/category/smite from the directory and also the other selectors will hide the channel if you search for it https://www.twitch.tv/search?term=smitegame
So technically there is no reason for the rule to fail, when everything is valid in terms of Devtools and native browser CSS selectors/pseudo classes.
Like I said, this rule fails in both Adguard MV2 and MV3 and makes the browser perform really slow as well, so whatever it is trying to do, it is not doing it.
I tried to make the same rule in other sites that looked a little like this one, forcing some complexity like: `:is(arg1 > .test, arg2, arg3:has(>.test2)):has([attr])` and they seemed to work, so I guess is because this rule has many `>` in the :is() part for each selector and also :has(>) and then another :has() on it. So I doubt many people will have issues with this, but it can happen and while breaking the rule to individual rules will work. I still wanted to report it, especially when it works fine in other adblockers so I thought just copy and pasting most rules like this would work in Adguard, but no.
Anyway, hope this has a fix so it's easier to use Adguard MV3 in other browsers that don't have native adblockers when Chromium moves to a MV3 only.
Thank you and have a good day.
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Evaluación
Este issue todavía no se ha evaluado.