Jump to content

Community

Could JQuery be replaced by vanilla JavaScript?


sobrenome
 Share

Recommended Posts

  • Management

I feel like anyone who lived through 1999-2006 feels the answer to "Do we need jQuery" is a strong yes.

Of course, we could remove jQuery.

What jQuery does is make life simpler for developers (as well as resolve a lot of cross browser quirks so developers don't have to think too hard about that). What that blog effectively advocates is the reversal of the number one rule of programming "be lazy". Functions and methods are reusable for a reason.

For an app as broad and as complex as ours, replacing jQuery with vanilla javascript isn't really viable. We have tens of thousands of lines of javascript code which will multiply into millions without reusable compact methods.

For a single page website, you probably could just about tolerate it, but honestly I question the effort even then; other than to feel happy as you sip a soy latte while stroking ones hipster beard before adding "Built with ❤️ in vanilla Javascript" in the footer.

Link to comment
Share on other sites

As JS continues to modernize and become more usable as a core scripting language, I feel like we'll see jQuery at the very least become superseded by something lighter and more powerful.

But there's never likely a time where we'll move to just raw JS for complex applications. Some type of library will always be needed for the reasons Matt said.

Those libraries will likely become lighter and faster, but they'll still exist.

Link to comment
Share on other sites

  • Management
3 minutes ago, Makoto said:

As JS continues to modernize and become more usable as a core scripting language, I feel like we'll see jQuery at the very least become superseded by something lighter and more powerful.

But there's never likely a time where we'll move to just raw JS for complex applications. Some type of library will always be needed for the reasons Matt said.

Those libraries will likely become lighter and faster, but they'll still exist.

Yeah, I agree. We picked jQuery a good while ago. If we were starting from scratch, we might pick something lighter now.

Link to comment
Share on other sites

jQuery is obviously not needed in 2021 - I'd love to do away with it. In reality, we have many thousands of lines of JS and the cost/benefit of rewriting everything for that reason alone isn't really there. Plus, we'd likely end up with a lot of helper methods that are essentially reimplementing some of jQuery's helper methods. We use some of the more advanced jQuery features too, so it wouldn't be as simple as updating .find to .querySelectorAll.

So, the answer is: yes, I agree, but it isn't as simple as saying "let's do that".

Also, in reality, if we were going to take the opportunity to redo our entire frontend codebase, we'd likely move to a reactive framework to build a better frontend, rather than simply rewriting what we have now but without jQuery. This will happen in time - we can't stay with the same code forever - but again it's about finding the right balance.

Link to comment
Share on other sites

On 2/22/2021 at 11:23 AM, Rikki said:

Also, in reality, if we were going to take the opportunity to redo our entire frontend codebase, we'd likely move to a reactive framework to build a better frontend

It would be amazing to use IPS with Next.js. I did all that I could to meet google core web vitals standards, but my community is still ranked as poor. With the current IPS software design I suppose that is impossible to be ranked as fast by google. And for those that need Adsense, absolutely impossible.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...

Important Information

We use technologies, such as cookies, to customise content and advertising, to provide social media features and to analyse traffic to the site. We also share information about your use of our site with our trusted social media, advertising and analytics partners. See more about cookies and our Privacy Policy