How to select text node in a div

Everything about using Adblock Plus on Mozilla Firefox, Thunderbird and SeaMonkey
Post Reply
johnman
Posts: 3
Joined: Sun Aug 02, 2020 9:21 am

How to select text node in a div

Post by johnman »

I have this :

Code: Select all

<div class="foo">
    <h3>Title</h3>
    Some text I want to block it
    <div class="subfoo">Some other text I dont want to block it</div>
</div>
Is it possible to select only text node ?
User avatar
greiner
ABP Developer
Posts: 899
Joined: Mon Sep 03, 2012 5:29 pm
Location: Cologne, Germany

Re: How to select text node in a div

Post by greiner »

Adblockers use CSS to hide elements on the page and, as far as I'm aware of, you cannot select or apply styles to text nodes.
johnman
Posts: 3
Joined: Sun Aug 02, 2020 9:21 am

Re: How to select text node in a div

Post by johnman »

Hello,
Is there any other way to do this, or i just cant block it anyway?
There is something really annoying and i want to block it.
pls help
johnman
Posts: 3
Joined: Sun Aug 02, 2020 9:21 am

Re: How to select text node in a div

Post by johnman »

Adblock used to be very useful, But this time it is just useless. Even nobody answer me in this forum. Why dont you use xpath /instead of this? It can do this shit.
User avatar
greiner
ABP Developer
Posts: 899
Joined: Mon Sep 03, 2012 5:29 pm
Location: Cologne, Germany

Re: How to select text node in a div

Post by greiner »

Similar to CSS, XPath can select elements on the page. For hiding those, however, you still need CSS styles, which cannot be applied to text nodes.

That being said, there's a proposal for adding a snippet that would allow you to create custom filters to either remove such text nodes from the page or to wrap them inside HTML elements and hide those ones instead (see core#240).
Post Reply