Ublock: Autogenerated filter breaks a web page

Created on 8 Apr 2017  路  5Comments  路  Source: gorhill/uBlock

Describe the issue

I'm not sure if it's a feature, but it's most likely a bug, I think. So, I was trying to block an element that included ads, but it was blocking other elements on the page as well. I started by right-clicking the element and clicking _Block element_. Then I tried to inspect the web page (which, BTW, is very poorly designed) and it seemed that there was nothing wrong with the filter that uBlock Origin has generated, but it was clearly blocking other portions of the page as well. After about 5 minutes of tinkering, suddenly, it hit me. The autogenerated filter's CSS selector doesn't start with body >, so it matches multiple elements in the DOM tree.

One or more specific URLs where the issue occurs

  • Page URL: _https://forum.ge/_

    • Ad container CSS selector: body > table > tbody > tr > td:nth-child(2)

    • Ad container XPath: /html/body/table/tbody/tr/td[2]

Screenshot in which the issue can be seen

uBlock element picker

Steps for anyone to reproduce the issue

  1. Right-click the element.
  2. Click _Block element_.

Your settings

  • Autogenerated filter: ##table > tbody > tr > td:nth-of-type(2)
  • Working filter: ##body > table > tbody > tr > td:nth-of-type(2)
  • OS/version: Manjaro Linux 17.0.1 (Gellivara) KDE
  • Browser/version: Chrome 57.0.2987.110 (Stable channel)
  • uBlock Origin version: 1.11.4
Your filter lists

Irrelevant.

Your custom filters (if any)

Irrelevant.

All 5 comments

add

||sab.turbo.ge^$script
||forum.ge/trash/*
||adjarabet.com^$domain=forum.ge

@mapx-

add

||sab.turbo.ge^$script
||forum.ge/trash/*
||adjarabet.com^$domain=forum.ge

Thanks, but I'm not asking for help; I'm just reporting a bug...

Besides, this configuration won't hide the elements, so the ad placeholders won't go away...

add also
||sab.turbo.ge^$subdocument

_sab.turbo.ge_ is an ad serving service, so I'm blocking the domain altogether. I'm also hiding the elements on the website using the following:

forum.ge###ipbwrapper > table:nth-of-type(1) > tbody > tr > td:nth-of-type(2)
forum.ge###ipbwrapper > .tableborder > table > tbody > tr > .row4:nth-of-type(2) > table > tbody > tr > .desc
forum.ge##body > table > tbody > tr > td:nth-of-type(2)

The point is, I'm not asking for help; I just thought that it's a good idea to start filters' CSS selectors with body > when it's not possible to use ID, so it won't match multiple elements by default.

I can reproduce.

uBO should automatically prepend body > when the suggested filter is still ambiguous after using all the components in the stack.

Was this page helpful?
0 / 5 - 0 ratings