In a strange way Jquery can sometimes reduce code as well... for extremely large projects that is.
$('#nav').addClass('hide'); vs document.querySelector('#nav').classList.add('hide')
It is almost half the size... I mean it would take a lot of code IIRC its 90kb, but if you have a huge single page project in the long run you could end up saving.
Jquery covers a lot of things and a lot of backward compatibilities. If they went through it and removed all the backwards compatibility bs they could probably shop it down to 40kb easily.
For example I wrote my own mini jquery clone. It only has a few things, but they are what I used jquery for the most.
example: .html() .addClass() .toggledClass() .addClass() and a few others, but its 1.6kb and it handles all the matches as well. $('#items li').
I've also seen a pretty big project where they just dedicated a shorthand for 'document.querySelectorAll()'. which was '__()'.
The literal code was var __ = (s) => {return document.querySelector(s)}
I guess I rarely use libraries if I don't have to. If it is something small there is no point and if it is really big then you are probably using something else (view, react or whatever).
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Idk why I find JQuery's syntax clean and compact than the Vanilla JS.
In a strange way Jquery can sometimes reduce code as well... for extremely large projects that is.
$('#nav').addClass('hide'); vs document.querySelector('#nav').classList.add('hide')
It is almost half the size... I mean it would take a lot of code IIRC its 90kb, but if you have a huge single page project in the long run you could end up saving.
Jquery covers a lot of things and a lot of backward compatibilities. If they went through it and removed all the backwards compatibility bs they could probably shop it down to 40kb easily.
For example I wrote my own mini jquery clone. It only has a few things, but they are what I used jquery for the most.
example: .html() .addClass() .toggledClass() .addClass() and a few others, but its 1.6kb and it handles all the matches as well. $('#items li').
I've also seen a pretty big project where they just dedicated a shorthand for 'document.querySelectorAll()'. which was '__()'.
The literal code was var __ = (s) => {return document.querySelector(s)}
I guess I rarely use libraries if I don't have to. If it is something small there is no point and if it is really big then you are probably using something else (view, react or whatever).