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

::before pseudo-element + procedural filters like :has-text() doesn't work #2786

Closed
8 tasks done
MasterKia opened this issue Aug 25, 2023 · 8 comments
Closed
8 tasks done
Labels
bug Something isn't working fixed issue has been addressed

Comments

@MasterKia
Copy link
Member

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 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

This filter only works on Chromium (v115) and doesn't work on Firefox (v116):

www.bing.com##li.b_algo:has(div) h2::before:style(content: 'Second Text' !important; color: #E6000D !important;)

But this one without :has() works in both browsers:

www.bing.com##li.b_algo h2::before:style(content: 'First Text' !important; color: #E6000D !important;)

image

A specific URL where the issue occurs.

https://www.bing.com/search?go=Search&q=download+vlc&qs=ds&form=QBRE

Steps to Reproduce

.

Expected behavior

.

Actual behavior

.

uBO version

1.51.1rc1 dev

Browser name and version

.

Operating System and version

.

@gwarser
Copy link

gwarser commented Aug 25, 2023

Native has not enabled in Firefox yet?

@gorhill
Copy link
Member

gorhill commented Aug 25, 2023

It's not possible to programmatically query a selector using ::before, so it's not something that can be fixed. Your selector li.b_algo:has(div) h2::before requires a procedural filter for platforms not supporting native :has(), thus that filter can't work.

uBO should report such filter as en error in Firefox, so that is the thing to fix.

@MasterKia
Copy link
Member Author

Native has not enabled in Firefox yet?

No: https://caniuse.com/css-has

uBO should report such filter as an error in Firefox, so that is the thing to fix.

Also :has-text() doesn't work with ::before on both Chromium and Firefox.

www.bing.com##li.b_algo:has-text(a) h2::before:style(content: 'Second Text' !important; color: #E6000D !important;)

@MasterKia MasterKia changed the title ::before pseudo-element + :has() + :style() doesn't work on Firefox ::before pseudo-element + procedural filters like :has() and :has-text() doesn't work Aug 25, 2023
@garry-ut99

This comment was marked as abuse.

@krystian3w

This comment was marked as off-topic.

@krystian3w
Copy link

krystian3w commented Aug 31, 2023

May post was not spam... screen shows a CSS4.

@JobcenterTycoon
Copy link

Native has will be enabled by default in Firefox 121 https://caniuse.com/?search=%3Ahas()

@MasterKia MasterKia changed the title ::before pseudo-element + procedural filters like :has() and :has-text() doesn't work ::before pseudo-element + procedural filters like :has-text() doesn't work Nov 10, 2023
@u-RraaLL
Copy link
Contributor

u-RraaLL commented Dec 10, 2023

Native has will be enabled by default in Firefox 121 https://caniuse.com/?search=%3Ahas()

But:

Pseudo-elements are also not valid selectors within :has() and pseudo-elements are not valid anchors for :has().

https://developer.mozilla.org/en-US/docs/Web/CSS/:has

Edit: Which I now read is not the issue here... Anyway, 9 more days to the release.

@gwarser gwarser added bug Something isn't working fixed issue has been addressed labels Jan 16, 2024
@gwarser gwarser closed this as completed Jan 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed issue has been addressed
Projects
None yet
Development

No branches or pull requests

7 participants