qpixel icon indicating copy to clipboard operation
qpixel copied to clipboard

Remove jQuery

Open ArtOfCode- opened this issue 1 year ago • 2 comments

Removes the jQuery dependency from our code - see #1429.

WIP: Re-write scripts to use vanilla JS instead of jQuery.

Once scripts are rewritten we can remove the dependency itself.

Help wanted!

TODO LIST - please tick a file if you're about to review & update it so we don't duplicate work.

  • [x] micro_auth/apps.js
  • [x] admin.js
  • [x] application.js
  • [x] caret.js (utility, no update needed)
  • [ ] categories.js
  • [ ] character_count.js
  • [x] closure.js
  • [x] codeblocks.js
  • [ ] comments.js
  • [ ] donations.js
  • [ ] embed.js
  • [ ] filters.js
  • [ ] flags.js
  • [ ] keyboard_tools.js
  • [x] latex_escape.js (utility, update not required)
  • [ ] licenses.js
  • [ ] markdown.js
  • [x] mod_warning.js
  • [x] modals.js
  • [ ] moderator.js
  • [ ] notifications.js
  • [ ] post_histories.js
  • [ ] posts.js
  • [ ] preferences.js
  • [ ] privileges.js
  • [ ] qpixel_api.js
  • [x] qpixel_dom.js
  • [ ] reactions.js
  • [ ] search.js
  • [ ] site_settings.js
  • [ ] subscriptions.js
  • [ ] suggested_edits.js
  • [ ] tag_sets.js
  • [ ] tags.js
  • [ ] textarea_popup.js
  • [ ] tour.js
  • [ ] two_factor.js
  • [ ] users.js
  • [ ] votes.js

ArtOfCode- avatar Oct 12 '24 11:10 ArtOfCode-

Slight roadblock: rails-ujs also depends on jQuery. This powers things like remote links/forms, which we use a bunch of. It's not impossible to replace, but it's a bunch more work.

My strategy at the moment is going to be to start by converting everything that doesn't use rails-ujs, leaving those bits as jQuery for the moment.

ArtOfCode- avatar Oct 12 '24 14:10 ArtOfCode-

Roadblock number 2: we use select2 for our interactive <select> elements, which is a jQuery plugin.

ArtOfCode- avatar Oct 12 '24 15:10 ArtOfCode-

Merging so this work doesn't just fester & we can continue to remove jQuery as we go.

ArtOfCode- avatar Apr 05 '25 16:04 ArtOfCode-

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 64.28%. Comparing base (2cea3f4) to head (2aab60a). Report is 16 commits behind head on develop.

Additional details and impacted files
Components Coverage Δ
controllers 59.24% <ø> (ø)
helpers 68.18% <ø> (ø)
jobs 28.00% <ø> (ø)
models 80.09% <ø> (ø)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

codecov[bot] avatar Apr 05 '25 16:04 codecov[bot]