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

Code style: discuss removing dependency on jQuery #1429

Open
trichoplax opened this issue Oct 11, 2024 · 4 comments · May be fixed by #1431
Open

Code style: discuss removing dependency on jQuery #1429

trichoplax opened this issue Oct 11, 2024 · 4 comments · May be fixed by #1431
Labels
area: frontend Changes to front-end code complexity: unassessed Needs further developer investigation before complexity/feasibility can be determined. priority: low type: change request New feature or request

Comments

@trichoplax
Copy link
Contributor

If there is consensus among the team, I'd like to see jQuery removed from the codebase. I'm raising this issue so people can discuss and add reasons for or against.

@trichoplax
Copy link
Contributor Author

My reasons for preferring native JS over jQuery:

  • Nowadays jQuery isn't much shorter than native JS, and browser compatibility is no longer a problem (any counterexamples that still apply?)
  • jQuery is less readable (subjective but I prefer spelt out names, particularly now that $ is used for JS template literals)
  • jQuery is slower
  • jQuery is potentially less secure
  • New contributors may have experience with JavaScript but not jQuery

@Oaphi
Copy link
Member

Oaphi commented Oct 11, 2024

Seconding the motion. There are also reliability concerns as we have to wait until (and if it is available at all in the first place) it's available before we are able to make any JS-based actions. In addition, we have to ensure that it is loaded on each and every page.
Moreover, strictly typing our JS assets (not necessarily via TypeScript - we already have a lot typed with JSDoc), which would've prevented at least several production-facing bugs already, requires making the developer environment aware of jQ, which is is not as straightforward with our codebase.

@ArtOfCode-
Copy link
Member

I think I agree in principle. A lot has moved on from a few years ago when we last had this discussion and I was on the fence.

My main remaining concern would be browser compatibility; jQ provides us guaranteed compatibility based on the version we use; browser API support can vary and there may well be places we need to add fallback logic, which I dislike. Is that worth removing the dependency? On balance, probably.

I'll start a branch/PR to remove jQuery. Contributions welcome.

@ArtOfCode- ArtOfCode- linked a pull request Oct 12, 2024 that will close this issue
39 tasks
@ArtOfCode- ArtOfCode- linked a pull request Oct 12, 2024 that will close this issue
39 tasks
@cellio cellio added area: frontend Changes to front-end code type: change request New feature or request complexity: unassessed Needs further developer investigation before complexity/feasibility can be determined. labels Oct 15, 2024
@cellio
Copy link
Member

cellio commented Oct 15, 2024

I'll leave setting priority to @ArtOfCode- .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: frontend Changes to front-end code complexity: unassessed Needs further developer investigation before complexity/feasibility can be determined. priority: low type: change request New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants