Scriptlets
Scriptlets copied to clipboard
Improve 'remove-node-text' — add an ability to remove text node of specified element
Sometime a filter maintainer needs to remove a string in an element's child text.
<div id="root">
REMOVE_THIS_STRING
<div id="login">
<div id="stats">
</div>
For a real case, a leftover created by AdGuard CoreLibs-based program is not removed by the remove-node-text
scriptlet.
https://zdnet.co.kr/view/?no=20231026135022
Screenshot
Before you test the real case, please add the following filter:
zdnet.co.kr#@$#body > div[id^="A1_"][style*="height:"] ~ #wrap { margin-top: -1.5em !important; }
You can use #text
as a nodeName
in remove-node-text
, for example something like:
zdnet.co.kr#%#//scriptlet('remove-node-text', '#text', 'Blocked by AdGuard')
Or do you mean that you would like to have something like selector > #text
?
I did not test with #text
as a second parameter.
To avoid an incorrect blocking, I think that selector > #text
is better.
By the way, Is using the #text
as a second parameter in remove-node-text
scriptlet Adguard scriptlet's own feature?
By the way, Is using the #text as a second parameter in remove-node-text scriptlet Adguard scriptlet's own feature?
I don't think so.
For text
nodes, the nodeName
returns #text
- https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeName, so it's rather not an own feature.