0

I am developing a website for a client. I have liberty to choose technologies to be used. For all my sites till now I've always used jQuery for front-end development. But for this site I thought I should go on with vanilla javascript only.

The plan is to use CSS techniques as much as possible to UI/UX effects. Make use of the javascript minimum. There are some cases like sliders where javascript is required. For such situations there are various plugins available on the web in vanilla JS, though not as many as jQuery dependant plugins.

The major reason to take this step is to make site lightweight as much as possible, of course, I have to optimise CSS & images too for that purpose. JS is just one step.

What I want to ask this community is whether it is a good decision or not, the doubts in my mind are as follows:

  1. Is it really worth ditching JQuery for performance optimisation? (Considering longer development time, although not much difference)
  2. Currently I am the sole front end developer, but if in future another developer joined the project will the project be understandable to him/her? (Not many web developers are very much familiar with working in only vanilla JS!)
  3. Are vanilla JS plugins available on web are stable? Cause javascript is little bit inconsistent among the browsers.

Edit:

Please note, I am not removing jQuery because it is causing some problem. Nope, its been great using it. But now I am using CSS3 more & more whenever possible. The only place jQuery is used if some sliders & some show/hide function. Which is doable using javascript too, and for rest all function such as click or submit jQuery is not really necessary. Instead of keeping it with little use, I want to remove it completely.

demonofthemist
  • 4,081
  • 4
  • 26
  • 45
  • My guess is that you or someone else will re add it later. – Shipow Apr 27 '16 at 06:48
  • @Shipow I am thinking same too, wanna know if this is what happen with developers when they want to use pure javascript? – demonofthemist Apr 27 '16 at 06:50
  • I think when it comes to manipulate DOM especially for a UI with CSS effects and fine interactions, jquery is still very handy and needs less line of codes. Also more easy to maintain. – Shipow Apr 27 '16 at 07:31

2 Answers2

2

I have written dozens of Enterprise level web applications for a half dozen clients. jQuery has been reliable and never the source of performance related issue.

You will be reverse engineering some of the steps jQuery uses for marginal performance gains, and at the end of the day I don't think that is worth it.

The real question you should be asking yourself is if jQuery is causing your performance issues how are you misusing it?

Just take a look at testimonials by the Stack Overflow community:

When to use Vanilla JavaScript vs. jQuery?

Advantages of using pure javascript over jquery

Community
  • 1
  • 1
FiringSquadWitness
  • 666
  • 1
  • 10
  • 27
2

I would say it really depends on the type of website you gonna work on. jQuery doesn't really bring much to the scene nowadays really, except some simplified method to play with DOM objects.

As a developer you should indeed try to use something else than jQuery. You could go full vanilla or use the trend of today: React.js or AngularJS, but again it really depends on the website you wanna write. For smaller libraries, you can look at Vuejs, WizUI, Riot. For animation you can look at tweenjs, tina, ...

I've been against jQuery for years (and still are) because in my opinion it helps developer following bad practice. For years now I also gave up on writing any HTML, I prefer to use Javascript for that.

In any case I would suggest you to use webpack and npm for development. By using vanilla, you will also learn what browsers can really do and how they do it (event loop, reflow/redraw, ...).

micky2be
  • 86
  • 6