Skip to content

chore(deps): reduce jQuery usage#851

Open
rrrnld wants to merge 5 commits into
murdos:masterfrom
rrrnld:fix/reduce-jquery
Open

chore(deps): reduce jQuery usage#851
rrrnld wants to merge 5 commits into
murdos:masterfrom
rrrnld:fix/reduce-jquery

Conversation

@rrrnld

@rrrnld rrrnld commented Mar 27, 2026

Copy link
Copy Markdown

These patches change some of the jQuery-isms with widely available vanilla JS alternatives, working towards the goal of reducing the dependency on jQuery (and thereby also on an external CDN). I have tried to split the changes into separate commits, but some are still quite large. Especially 5747bdd a4d8e03 should be reviewed carefully, because $.each does more than [].forEach and I'm not sure I caught everything correctly.

@rrrnld rrrnld force-pushed the fix/reduce-jquery branch 3 times, most recently from 3076dfa to 50dba27 Compare March 27, 2026 07:09
@rrrnld rrrnld force-pushed the fix/reduce-jquery branch from 50dba27 to 9dec8ad Compare March 27, 2026 07:23
@rrrnld rrrnld force-pushed the fix/reduce-jquery branch from 9dec8ad to ee06244 Compare March 27, 2026 07:24
@rrrnld rrrnld changed the title Reduce jQuery usage chore(deps): reduce jQuery usage Mar 27, 2026
@arsinclair

arsinclair commented Mar 31, 2026

Copy link
Copy Markdown
Collaborator

Hey @rrrnld! Thank you for this change, this is definitely an improvement as using jQuery in 2026 is not strictly necessary.

Would you be able to group your changes by-script, instead of changes cutting across all scripts? So e.g. one PR per script.

I suppose this is adding some extra work, but I think it would facilitate testing and deployment, since we'd probably want to bump all script versions right after this change to avoid holding too many unreleased and thus not widely user-tested changes in the repo.

Or maybe you had some other release strategy in mind?

@rrrnld

rrrnld commented Mar 31, 2026

Copy link
Copy Markdown
Author

Hi @arsinclair!

I don't how these user scripts are tested, and therefore I couldn't consider this when preparing the PR. How are they tested?

I grouped the commits by method because I hoped it would be easy to spot logic errors when looking at the individual commits, and try to understand the 1-to-1 replacements.

Note that I haven't fully removed jQuery in any the individual importers, because I wasn't able to replace all method calls anywhere, but my primary motivation was to contribute to that (following earlier discussion like in #468). Not just for style reasons, but also because I'd personally appreciate completely removing the dependency on external CDNs for privacy reasons. However I'm afraid I don't have the spare time to finish this at the moment. I don't know if it's desirable to do this for some importers only, I feel like it might cause the different coding styles to diverge and potentially be confusing.

I would still try to proceed with the way this is structured here, and maybe only pick the commits that are easy to make sense of (like 7649286 c3140a1) in case some are hard to review by only reading the code.

@rrrnld rrrnld force-pushed the fix/reduce-jquery branch from ee06244 to 0df8d48 Compare March 31, 2026 18:40
@arsinclair

arsinclair commented Apr 1, 2026

Copy link
Copy Markdown
Collaborator

Yes, I suppose this is a good move to remove the dependency on jQuery not only for privacy reasons, but also just to make the code simpler, so I fully agree here.

I don't use all the importers myself on a daily basis, but if I need to make change to one of them, I usually just edit the script source code in my Violentmonkey extension, test on a live site that it works and that I didn't break anything and then I bump the version and release it. For some bigger changes and for the scripts that I actually use I try to run them like that for a couple of weeks on my own machine before releasing. That is to say, there's no automated testing and each change you have to test manually.

I feel like it might cause the different coding styles to diverge and potentially be confusing

I wouldn't worry much about it. jQuery at this point is just a convenience wrapper, not a must-have instrument and swapping it with native document.* APIs won't cause the code to become confusing.


It might be tricky for me to find time to test all changed scripts before merging this PR that's why I suggested to break them apart into individual PRs, since doing it incrementally is easier. But I suppose since there's no real urgency to getting it merged, this approach is also fine.

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

Successfully merging this pull request may close these issues.

2 participants