Page 1 of 1

How to select text node in a div

PostPosted: Sun Aug 02, 2020 9:33 am
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 ?

Re: How to select text node in a div

PostPosted: Mon Aug 03, 2020 1:13 pm
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.

Re: How to select text node in a div

PostPosted: Wed Aug 05, 2020 6:08 am
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

Re: How to select text node in a div

PostPosted: Tue Aug 11, 2020 5:32 am
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.

Re: How to select text node in a div

PostPosted: Tue Aug 11, 2020 4:14 pm
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).