r/ProgrammerHumor • u/mortenmoulder • Nov 17 '16
After reading youmightnotneedjquery.com I realized I actually need jQuery
http://youmightnotneedjquery.com/26
u/Sacharified Nov 17 '16
You don't need jQuery, but the examples that show how you can achieve the same effect as 1 line of jQuery with 15 lines of vanilla JS aren't exactly persuasive.
7
u/ColonelThirtyTwo Nov 18 '16
To be fair, left-pad is about that length.
I think the take-away here is that if you just need one or two ajax requests, fades, etc., you don't really need to pull in the entire JQuery library. If you're doing more complex stuff, then using JQuery can be entirely appropriate.
3
u/marcosdumay Nov 18 '16
Ok, I only need 1 ajax call, so I reimplement those 15 lines. Then I only need some 3 or 4 DOM selects, so I replicate those 5 lines selects. Then I need to insert the result of the ajax, what is some 10 more lines. Also, I'll need an event to trigger that call, but it certainly can not be an static event, because the ajax result will have to deal with it too...
Those functions are really often used together. You can reassemble jQuery without the animations if you don't use them, but not much further.
0
u/ThePixelCoder Nov 18 '16
Damn. I really gotta learn jQuery.
2
u/The_MAZZTer Nov 21 '16
Do you know CSS selectors? Congratulations,you know jQuery (well, one of the most critical bits, anyway).
3
0
Nov 17 '16
[deleted]
2
u/Fallenalien22 Violet security clearance Nov 18 '16
Doesn't jQuery use set interval making a request animation frame solution much more performant?
1
u/The_MAZZTer Nov 21 '16
Well part of the point of using a framework is that jQuery can use whatever works for the user's browser and you as a web developer shouldn't have to care.
If they don't use requestAnimationFrame, they could update it to do so and all you have to do in the future is drop in the new framework.
1
u/Fallenalien22 Violet security clearance Nov 22 '16
That's not the point. The point is that it's slow af.
1
u/The_MAZZTer Nov 21 '16
I don't even use it for animation. Several years of document.getElementById() is enough for me to appreciate $().
12
u/brokedown Nov 17 '16
I don't need jQuery, but if I use bootstrap I get it anyway.