Closed DandelionSprout closed 3 years ago
Well, the way it works in uBO is wrong according to the CSS spec and I'd prefer not to repeat this. This may cause problems in the future. Imagine that at some point :has
finally becomes a part of CSS and the rules that were previously applied using javascript, will use standard CSS instead. When this happens, all those rules that were relying on this feature will completely unexpectedly change the way they work.
On a side note, I don't like combining multiple CSS selectors in one rule. It makes it harder to analyze rules and figure out which one is not necessary anymore.
CC @gorhill is this a bug or a feature?
By design -- the advice is to not use commas this way when using procedural operators.
Supporting commas exactly as in CSS would require a full CSS parser, which is a lot of code and burdensome for content scripts. I believe you just extend Sizzle, so this come free for you but on my side I rather keep the content scripts as lean as can be at the expense of having to split a cosmetic filter in two, which is trivial for filter authors.
Important: ... Concatenating multiple procedural selectors in one filter is not supported.
example.com##p:has(img),div:has-text(advert)
will not work as expected (#453).
Looks like :is
is now supported?
If so, something like this should work in both AdGuard and uBO with same result:
##:is(span,section,kur-room__title):has-text(korona)
Looks like :is is now supported?
Does not seem to work with document.querySelectorAll
.
Anyways, @DandelionSprout, we'll implement :is
as a part of ExtCSS and this would allow using rules like this.
https://developer.mozilla.org/en-US/docs/Web/CSS/:is
claims that :is
is Firefox-only, for the record.
Does not seem to work with
document.querySelectorAll
I tried in Firefox, it worked. It seems Chromium does not support it yet, but rather support the alias :-webkit-any
.
Works in Chrome Canary so it's not too long till it starts working everywhere.
I've found what may or may not be a bug, reproduced in both AdGuard for Windows and Android.
With the custom example entry
nrk.no##span,section,kur-room__title:has-text(korona)
onwww.nrk.no
:uBlock Origin: Blocks
span
,section
and/orkur-room__title
elements containing the textkorona
AdGuard: Blocks allspan
andsection
elements, as well askur-room__title
elements containing the textkorona
I vastly prefer the former approach and have utilised it for e.g. Anti-FiM List, which works amazingly for uBO users, but which would cause AdGuard users to see near-empty pages on sites like
YouTube
,Deezer
,DailyMotion
andMastodon
.Therefore I want to ask whether the latter approach is something that you guys chose to do intentionally, or if it's something that needs to be fixed?