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

Migrate additional arguments from scriptlets to the remove-attr and remove-class action operators #3537

Open
9 tasks done
scripthunter7 opened this issue Jan 28, 2025 · 11 comments

Comments

@scripthunter7
Copy link

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 YouTube, Facebook or Twitch report. These sites MUST be reported by clicking their respective links.
  • 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

The remove-class scriptlet is deprecated in favor of the :remove-class(...) pseudo-class (action operator). However, the scriptlet supported an applying parameter (e.g., asap, complete), which the action operator currently doesn't.

References:

Similarly, the remove-attr action operator doesn't support parameters that the scriptlet previously allowed.

References:

A specific URL where the issue occurs.

not relevant

Steps to Reproduce

not relevant

Expected behavior

I suggest that the action operators should also support the extra parameters from the scriptlets, e.g., ##selector:remove-class(class, complete).

Actual behavior

Currently, the action operators support only a single argument.

uBO version

latest

Browser name and version

not relevant

Operating System and version

not relevant

@scripthunter7 scripthunter7 changed the title Migrate additional arguments from scriptlets to the remove-attr and remove-class action operators Migrate additional arguments from scriptlets to the remove-attr and remove-class action operators Jan 28, 2025
@scripthunter7
Copy link
Author

scripthunter7 commented Jan 28, 2025

I'm attaching a commit from the hufilter that brought this issue to my attention:
hufilter/hufilter@fb3b235#diff-5bb213a564e34cb495b3179ad6919a0ef56692dec21f31e6e12d55764f666d10

For example, I suspect that the modal used as a cookie modal might also be used by the website for other functions. I don't necessarily want to universally disable scroll blocking, so I chose the complete option.

@peace2000
Copy link
Member

peace2000 commented Jan 29, 2025

Is there an use case where the new action operator version doesn't work properly, but the scriptlet version with asap / complete option works?

I'm not saying this to oppose, but I think that I've seen a case where the action operator version worked just fine, but the scriptlet version needed either asap or complete option. Though I don't remember anymore what case it was :)

@Yuki2718
Copy link

An example this is needed to deprecate the scriptlets; uBlockOrigin/uAssets#27167 kolnovel.org###kol_content:remove-attr(onmousedown|onselectstart) doesn't work here for the lack of stay support.

@stephenhawk8054
Copy link
Member

@Yuki2718 You mean on Firefox or chromium?

@Yuki2718
Copy link

I used Chrome at the time, but it's the same on Firefox as well.

@stephenhawk8054
Copy link
Member

If I remember correctly, on Firefox you can use :watch-attr(). It will behave like stay.

On chromium, :remove-attr() doesn't work for event listeners regardless.

@Yuki2718
Copy link

Yuki2718 commented Feb 11, 2025

On chromium, :remove-attr() doesn't work for event listeners regardless.

In this case it's just onmousedown="return false" onselectstart="return false" so mere removing is fine, and the scriptlet works with stay. The attributes are in thier source and not dynamic injection, no idea why stay is needed.

@stephenhawk8054
Copy link
Member

Does complete work instead of stay?

@Yuki2718
Copy link

Yes, complete works too. No additional argument doesn't.

@stephenhawk8054
Copy link
Member

Yeah, I think in this case we can use complete for both browsers so we don't need uBO to keep watching the element.

@Yuki2718
Copy link

uBlockOrigin/uAssets@7194468

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

No branches or pull requests

4 participants