Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ABP Custom Filter - How to select/Hide Parent element

Tags:

css

adblock

I want to know if there is a way to hide parent element of an identified element.

for example:

<div>
<span id="abx">some garbage content</span>
<div>other garbage containers not having any class or id</div>
</div>

The custom filter of AdBlockPlus to select abx will be:

##span#abx

But how to select its parent element? because we need to hide all siblings of identified element.

like image 746
Raheel Hasan Avatar asked Nov 27 '13 12:11

Raheel Hasan


People also ask

What is element hiding filters?

Element hiding filters are designed to indicate which element in the page are to be hidden. Snippet filters are used to run snippets of code in the page to defeat more complex advertising display.

How do you customize AdBlock?

Click the AdBlock icon on your browser's toolbar, then the gear symbol on the dropdown menu. On the options menu, select the Customize tab. Click Edit to open the custom filters field. Paste the filter exactly as given in the field (or delete any unwanted filters) and click Save.


2 Answers

You can use an AdblockPlus CSS selector.

#?#div:-abp-has(span###abx)

https://adblockplus.org/development-builds/new-syntax-for-advanced-element-hiding-rules

like image 156
Mark Choi Avatar answered Sep 20 '22 03:09

Mark Choi


You can't do that, because of limitations of CSS 3.

It will be possible after implementation of the relational pseudo-class: :has() from Selectors Level 4, with following syntax:

example.com##div:has(> #abx)

Current support for this feature.

like image 44
Przemek Avatar answered Sep 19 '22 03:09

Przemek