uBlockOrigin / uBlock-issues

This is the community-maintained issue tracker for uBlock Origin
https://github.com/gorhill/uBlock
878 stars 76 forks source link

matches-path does't work with exception #3235

Open Yuki2718 opened 1 month ago

Yuki2718 commented 1 month ago

Prerequisites

I tried to reproduce the issue when...

Description

On https://www.nicovideo.jp/search/%E4%BA%AC%E9%83%BD These don't work

www.nicovideo.jp##li.item
www.nicovideo.jp#@#:matches-path(/search)li.item

Using an exception is an official way to handle such cases in AG: https://github.com/AdguardTeam/CoreLibs/issues/124#issuecomment-903488983

A specific URL where the issue occurs.

https://www.nicovideo.jp/search/%E4%BA%AC%E9%83%BD

Steps to Reproduce

Mentioned

Expected behavior

:matches-path() should work as well for exception. Preferably ignore whitespace differences: www.nicovideo.jp#@#:matches-path(/search)li.item and www.nicovideo.jp#@#:matches-path(/search) li.item

Actual behavior

Mentioned

uBO version

1.57.3b10

Browser name and version

Chrome 124.0.6367.203

Operating System and version

Windows 10

gorhill commented 1 month ago

How about supporting negation in :matches-path?

www.nicovideo.jp#@#:matches-path(!/search) li.item
Yuki2718 commented 1 month ago

Isnt't that already possible by :not(:matches-path())? I'm more concerned about compatibility with AG lists.

gorhill commented 1 month ago

Yes, you're right. For compatibility with AdGuard, the proper course is to support the same syntax, :matches-path is not suitable for compatibility with AG's [path=...].

Yuki2718 commented 1 month ago

A problem is currently all the [path=...] rules for uBO version are converted to :matches-path() on FiltersCompiler, though I can open an issue if this should not be done in future.

krystian3w commented 1 month ago

You can try (I guess in 'uBo – unbreak'):

!+ PLATFORM(ext_ublock)
www.nicovideo.jp##:matches-path(/search) body li.item:style(display: list-item !important)

If display was not changed by webmaster to not standard.

Yuki2718 commented 1 month ago

Ofc I can fix whatever issues if it is me, but I don't know how other members fix issues.

krystian3w commented 1 month ago

If you mean threads that will not reach uAssets or AdGuardFilters (or reddit), the only thing left to do is write something like Wiki in popular place:

! 'search' broken by "##.ads":
!
!#if env_ublock
! disable filter at page in uBo
example.org#@#.ads
! recover in needed places
example.org##:not(:matches-path(/search)) .ads
!#else
[path="search"]example.org#@#.ads
!#endif

Due to the number of filters, if instead of the old "PLATFORM" starts to make sense.