r/webdev • • Feb 13 '19

Bootstrap 5 will remove jQuery as a dependency

https://github.com/twbs/bootstrap/pull/23586
1.5k Upvotes

398 comments sorted by

View all comments

Show parent comments

166

u/[deleted] Feb 13 '19

I think the main point is that you don't need jQuery anymore, not that it's too bloated. JS and the native browser APIs have come a long way. Sure it's only 30kb, but it's 30kb that you do not need to include at all, because it can now all be done in vanilla JS.

13

u/art-solopov Feb 13 '19

Yeah, I wish jQuery was more modular. Like, if I could just borrow the DOM stuff and the selectors and not carry another implementation of promises with me...

13

u/insanewriters Feb 13 '19

If you just want the DOM selector goodies, that is available separately: https://github.com/jquery/sizzle/tree/master

5

u/30thnight expert Feb 13 '19

Same, a refactor to ES6 exports would quell all the issues people have with it

→ More replies (4)

47

u/rhetoricl Feb 13 '19

A lot of stuff jquery did could be done back then in vanilla too? But it helped with cross browser compatibility.

73

u/LaSalsiccione Feb 13 '19

And if you still have to support those browsers then by all means use jQuery! The point is that, moving forward and for modern browsers, we don't need to so we shouldn't.

28

u/inabahare javascript Feb 13 '19

And if you still have to support those browsers then by all means use jQuery

Or transpile!

16

u/LaSalsiccione Feb 13 '19

Indeed, that is what I’d recommend but I didn’t want to add complications to my point that might put people off.

0

u/[deleted] Feb 13 '19

[deleted]

51

u/inabahare javascript Feb 13 '19

I can only say that I send my thought and prayers

6

u/[deleted] Feb 13 '19

Also someone that had to work with IE6 last year. Sacrificing an animal at midnight seems to be more effective at getting things backwards compatible.

→ More replies (2)

25

u/JBlitzen Feb 13 '19

Noooooo. Not even close.

Chrome could do most of jQuery’s stuff, but cross-browser was a fucking nightmare without it.

Five years later and it’s a totally different story.

I like to think that moving on from jQuery is in this case a rare example of the framework’s SUCCESS. It showed its value so effectively that the underlying language developed equivalent capabilities and so now it’s not outdated but rather redundant.

Extremely few frameworks or libraries can say the same thing.

24

u/King_Joffreys_Tits full-stack Feb 13 '19

Honestly I just like using jquery for the shorthand JavaScript dom rendering, editing, and animating. I know I can do it all in vanilla JavaScript, but I’m also really lazy.

3

u/[deleted] Feb 13 '19

Only reason why i'm sad about jqeury moving away.. I hate doing these things with JS..

11

u/King_Joffreys_Tits full-stack Feb 13 '19

document.getElementById(‘myelement’) vs $(‘#myelement’)

Gahhh my fingers are cramping up from writing those extra ~20 characters!

8

u/[deleted] Feb 13 '19

document.getElementById(‘myelement’) vs $(‘#myelement’)

There's also document.querySelector('#element') if we're not fussed about very old browsers. I personally find the syntax much nicer because you can use it in the same way you would with the jQuery selector - I can pass a string and not worry if it's an ID or a class.

2

u/IsABot Feb 13 '19

I know that's probably sarcasm, but honestly that's probably the main reason I still use jQuery here and there. When dealing with something that is thousands of lines long, all of the extra characters really add up. (i.e. I'm lazy.) At this point my company has so many legacy sites built with it. Rewriting all of it "the long way" is just too daunting of a task with so many other projects in the pipeline. One day I'll probably get around to it, but right now I still love the brevity of the jquery language.

→ More replies (1)
→ More replies (1)
→ More replies (3)

6

u/spays_marine Feb 13 '19

JQuery was also popular because it could do complex things easier than vanilla. Nowadays, compared to modern frameworks, the resulting code is archaic and generally pretty ugly and bloated because you're mangling the DOM instead of the data, which is the more common approach in new frameworks that take care of DOM manipulation behind the scenes.

→ More replies (1)

8

u/Baryn Feb 13 '19

It technically could be done, but it was a gargantuan, insane task without jQuery (obviously, this depends on the complexity of a given task, but I'm talking about serious apps of the day).

In 2019 (hell, in 2009), jQuery is largely unnecessary because all it really does for you is obfuscate the DOM API without any discernible benefit.

→ More replies (1)

17

u/superwinner Feb 13 '19

Sure it's only 30kb, but it's 30kb that you do not need to include at all

The smallest of the 300 images on one site I work on is larger than that.. lets get real.

16

u/csaccnt Feb 13 '19

Images aren't thread blocking like JS. 30kb of images vs 30kb of JS is very different

6

u/svtguy88 Feb 13 '19
defer

3

u/Ethesen Feb 14 '19

Still has to be compiled.

0

u/[deleted] Feb 13 '19

[deleted]

2

u/sammyseaborn Feb 18 '19

...and will likely start penalizing for low coverage as developers start adopting the easier practices.

This smells like bullshit. Do you have any sources to back up that claim? That would be a disastrous move on their part, to say the least.

→ More replies (1)
→ More replies (5)