-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for plaintext selectors? #1654
Comments
This was discussed recently in team https://github.com/orgs/uBlockOrigin/teams/ublock-issues-volunteers/discussions/282 What gorhill said: All operators expect element nodes as input, including If supporting text nodes is really something that comes up more than in just this case, than I could modify Modifying the DOM is a bad idea after all, so only solution I see is to make all operators and code using operators be mindful that a text node could be present as input -- not a trivial change. An easier solution would be to have a new operator which purpose is to remove text node which are immediate child of the subject node:
It's not a trivial change after all, so at this point not sure it's worth the amount of work for two cases which are not really that big of a deal. |
What I am reading in the opening comment does not convince me it's worth the amount of work and risks to stability. Also I would like the case to be better made, "I only want" sounds a lot like a personal itch (I cant load the site at the moment, and also I dont read Finnish) |
An ability to remove plaintext elements would probably be the most urgent as it comes to plain adblocking. The main reason for me personally to open this was that I would be able to make Yeah that Reddit thread is mine, peace2000 was already taken in Reddit so had to use another nick. |
Talks haven't progressed at CSSWG issue -- w3c/csswg-drafts#2208 |
I visited the site, and from Google Translate, the text you want to target is part of the article, i.e. this has nothing with uBO's primary purpose -- and anyway you can't restyle text nodes. There are cases of text nodes which might benefit from being removed, but this is not what the issue here is about. Declined. Also, any issue presented as "I want" vs. stating the exact problem to solve is unwelcome when the issue has nothign to do with uBO's primary purpose, I do not want to be used to scratch personal itches, you will have to ask or hire someone else for this. |
AdguardTeam/AdguardFilters#94170 |
That would really be not trivial to add such capability, so this would have to become a much more widespread serious issue before I would want to spend time on this. |
maybe possible to achieve what you want: No, see the DOM tree. The texts don't belong to ANY tag that can be hidden, so xpath doesn't help here. |
@Yuki2718 I agree that "remove-text" would be useful for this, though for this particular case... Why not just sweep them under the rug? :D
For the last sponsored text I couldn't find a good css style filter as I'm not that advanced with css. My filters work for the English side https://resizer.myct.jp/index-e.php for Japanese and Chinese side, other filters are needed. Someone better can continue... :) |
@peace2000 Yeah, css trick can be used, but I'm not much willing to just for them. I never know when they change site structure and the filters starts mal-behavior - it'll sound like a general concern, but the risk is much higher when |
True, though that particular site is very simple looking so I think that risk is lower. |
In any case I'll leave it to AG guys :D |
It seems this idea makes things easier to implement @gorhill |
Prerequisites
I tried to reproduce the issue when...
Description
I was trying to create a filter to pick a specific plaintext element, without picking it's parent
p
element. The parent element contained other plaintext elements as well which is why I didn't want to pick it - I only want to pick a specific plaintext, not it's siblings. Firefox's element inspector tool can pick it individually (I can even remove it):The text I want to pick in that picture is
Windows 11:n tapauksessa
.Can you add support for Ubo to pick plaintext elements like that (and make filters concerning them), without the need to pick it's parent element, thus picking also all it's siblings at the same time?
Related conversation: https://www.reddit.com/r/uBlockOrigin/comments/og9ayc/selector_for_plaintext_elements/
A specific URL where the issue occurs
https://www.mikrobitti.fi/uutiset/windows-11-paivitys-ilmainen-vain-rajoitetun-ajan-nain-kauan-tarjous-on-vahintaan-voimassa/dc7afa1e-23ce-4a99-9732-842bf4b6353d
Steps to Reproduce
Try to select any plaintext chunk via Ubo on any website (but not choosing it's parent element).
Expected behavior
Ubo would be able to select a plaintext element individually.
Actual behavior
Ubo cannot choose a plaintext element, no matter how I tried to make a filter via various
#text
andhas-text()
combinations.uBlock Origin version
1.36.2
Browser name and version
Mozilla Firefox 89.0.2
Operating System and version
Windows 10
The text was updated successfully, but these errors were encountered: