Skip to content
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

:has-text not allowed inside :is() or :where() #2349

Open
8 tasks done
Vanerio opened this issue Nov 5, 2022 · 8 comments
Open
8 tasks done

:has-text not allowed inside :is() or :where() #2349

Vanerio opened this issue Nov 5, 2022 · 8 comments
Labels
enhancement New feature or request

Comments

@Vanerio
Copy link

Vanerio commented Nov 5, 2022

Prerequisites

  • I verified that this is not a filter list issue. Report any issues with filter lists or broken website functionality in the uAssets issue tracker.
  • This is not a support issue or a question. For any support, questions or help, visit /r/uBlockOrigin.
  • I performed a cursory search of the issue tracker to avoid opening a duplicate issue.
  • The issue is not present after disabling uBO in the browser.
  • I checked the documentation to understand that the issue I am reporting is not normal behavior.

I tried to reproduce the issue when...

  • uBO is the only extension.
  • uBO uses default lists and settings.
  • using a new, unmodified browser profile.

Description

:has-text doesn´t work inside :is OR :where

Element picker doesn´t select as expected (1.44.5b15).
In latest stable version (1.44.4) the Element Picker shows an error with the formula provided in the next steps.

In case there is a similar issue, I coldn´t see it really as :is() :where() are conflictive terms to search.

Edit: I just want to make it clear that this does not work under either Element Picker or My Filters section.

A specific URL where the issue occurs.

https://github.com/uBlockOrigin/uBlock-issues/issues

Steps to Reproduce

  1. Go to https://github.com/uBlockOrigin/uBlock-issues/issues
  2. Open Element Picker and add: ##:is(.open.octicon,.IssueLabel:has-text(enhancement)):others()
  3. Note: You can also check this formula, that works perfectly without :has-text():
    ##:is(.open.octicon,.IssueLabel):others()

Expected behavior

Everything except Open Issue Icons and Enhancement Labels should be selected.

Actual behavior

Nothing is selected

uBO version

1.44.5b15

Browser name and version

Brave: 1.45.118

Operating System and version

Windows 10

@Vanerio Vanerio changed the title :has-text not allowed inside :is() OR :where() :has-text not allowed inside :is() or :where() Nov 5, 2022
@gwarser gwarser added the bug Something isn't working label Nov 6, 2022
@gorhill
Copy link
Member

gorhill commented Nov 6, 2022

:is() and :where() are not pseudo operators, they can't have pseudo operators as parameters -- so the issue here is a feature request, not a bug.

Given the case provided is contrived, i.e. not a real case world demonstrating this is needed, the incentive to make this work is close to zero.

@uBlock-user uBlock-user added enhancement New feature or request and removed bug Something isn't working labels Nov 6, 2022
@Vanerio
Copy link
Author

Vanerio commented Nov 6, 2022

Well, this particular case is contrived because it pretended to be easy to test.
I discovered this while trying to make a productive task: showing in page only threads that matches x:has-text() that are unread or if I received a PM. Or only show emails that are from x|y|z persons and have an important tag.

Using :others() for me saves a lot of time and makes my interface a lot of cleaner. I have been using this a lot, but this is the first time I needed a :has-text() match. So for me this totally makes sense in a real case world scenario where performance and minimalism is pursued.

I would be really thankful if this could be added in case it is not a very difficult task. I hope I could help you with that programming part, but I am not a programmer. In any case,, I would like to thank you for your amazing work.

@Vanerio
Copy link
Author

Vanerio commented Nov 6, 2022

Here I show you how I clean my interface to enhace performance. It is a real example: I remove every part I don´t need and I only show unread threads and notifications (with just a simple line). I don´t know if this is a real case scenario to be honest, For me it is actually and uBlock helps me a lot doing that and increases efficiency in my work by keeping my interface straighforward. This is a really big forum simplified into 5 items.

Example

There are other cases where has-text() would help me to be a lot more precise by adding a powerful filter.

@gorhill
Copy link
Member

gorhill commented Nov 6, 2022

Well given your case in opening comment, I would just suggest to use:

##.IssueLabel:has-text(enhancement):upward(.js-issue-row):others()

I am pretty sure I could come up with something equivalent for your specific case if I knew the details.

@Vanerio
Copy link
Author

Vanerio commented Nov 6, 2022

Well given your case in opening comment, I would just suggest to use:

##.IssueLabel:has-text(enhancement):upward(.js-issue-row):others()

I am pretty sure I could come up with something equivalent for your specific case if I knew the details.

This works perfect if you only need to isolate rows, but the thing is, if you need to isolate not only rows, but, lets say, also .js-feature-preview-indicator-container , you can not combine them (with :is or :where) because of :has-text()
Like in my example, where I try to isolate two different things.
Example isolating just 3 things::
##:is(.unread:has-text(xxx|yy|zzz), .notifications, .action-bar):others()

Edit: Another real example for me (maybe i'm using uBlock for things it wasn't supposed to be used for? haha)
This is how my outlook looks like. I isolate unread emails and two buttons. Thats it. The case is that in other scenarios :has-text() would be needed.
Outlook

@jasonkhanlar

This comment was marked as off-topic.

@gorhill

This comment was marked as off-topic.

@krystian3w

This comment was marked as resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants