r/Frontend • u/speckz • Feb 13 '19
Bootstrap 5 will remove jQuery as a dependency
https://github.com/twbs/bootstrap/pull/235861
Feb 13 '19
it will happen during 4x. there's a branch in the repo for it.
https://github.com/twbs/bootstrap/tree/v4-without-jquery
did you just stumble upon this nearly 2 year old thread and decide it wasn't worth looking further into?
0
Feb 13 '19
[deleted]
3
u/DOSMasterrace Feb 13 '19
Because native javascript methods have begun to simplify and standardize to the point where there's far less benefit using jQuery compared to ten-plus years ago.
1
u/kjriowhjowhjguo Feb 15 '19
I love jQuery, I started using it when it first came out and was in a small battle with mootools and prototype.js.
A lot of the capability has been appropriated by browsers, but the convenience and beautiful API that features group operations, chainings, null handling, cross-browser compatibility, etc makes it a compelling library.
That said, I've been doing this for the last 14 years, and the imperative model of writing front end code is outdated at this point. Declarative frameworks (React, Vue, etc) simplify rendering and make it more simple to understand and more maintainable.
The jQuery/imperative way is easy to get out of sync if you aren't careful to avoid side effects. Do you really want to be adding and removing table rows based on AJAX call results manually using jQuery, or do you want to say "This table should render like this" and inject data into it and have it magically update itself?
1
-3
u/Renive Feb 13 '19
Because frameworks like React Angular Vue invalidate its usage hard. You should never ever manually manipulate dom.
2
u/crazedizzled Feb 13 '19
You should never ever manually manipulate dom.
Depends on your needs. It's not really worth going through the hassle of something like React just to add a simple node after an event.
-1
u/Renive Feb 13 '19
But never mix it. Either you go React/Angular/Vue fully commited, or you don't.
3
u/crazedizzled Feb 13 '19
If you're starting a new project, no of course not. But mixing is a good strategy for migrating an old legacy jQuery app.
0
1
u/herjin Feb 13 '19
Curious to hear your opinion about this. There are plenty of examples of gradually updating an application to Vue or React one component at a time.
0
u/Renive Feb 13 '19
You can with both of them, not so much Angular, but if you had your frontend based on dom manipulation directly its a tectonic shift and most likely you migrate pages fully. You dont have to do all of them at once, that's unreasonable but dont leave pages mixed.
21
u/magenta_placenta Feb 13 '19
jquery still does a lot of incredibly useful stuff. The best advertisement for jquery, ironically, is this site: http://youmightnotneedjquery.com/ Look at how simple things are in the left column, and how much more code is needed in the right column.
jquery has many convenience features such as chaining, for example: item.addClass('selected').siblings().removeClass('selected'); and you don't have to check for nulls after each selection.
Many functions such as closest() and remove() have no equivalents in IE11, and other things such as replaceWith() and before() are not available even in Edge.
For simple sites it is easy enough to remove jquery, but for more complex javascript applications, especially apps that have a lot of interactivity, removing jquery will result in more code, or you will end up writing a lot of utility functions thereby creating your own little clone of jquery.
Also, I'm sure a lot of sites and apps that use BS5 will continue to use jquery for other things anyway (all it takes is one plugin) so, in reality, a lot of BS5 sites won't have less code.
jquery may be outdated from a javascript point of view, but nothing beats its syntax. Nothing is as simple and straightforward. It's not cool anymore but there's little compelling reason to tear it out of existing projects other than a refactor. It still works great.