DEV Community

[Comment from a deleted post]
Collapse
 
ahferroin7 profile image
Austin S. Hemmelgarn

For what specific purpose?

Most of the classic arguments for jQuery are no longer consistently valid. However, it's got a few small benefits for some users:

  • It can actually make your code significantly smaller. $() is about 10% of the size of document.querySelectorAll(), and a number of jQuery methods are much more compact than their DOM equivalents. Actually benefiting from this requires you to save almost 100kb of space with it though, so it's only worthwhile for big projects unless you want to try and rely on CDN caching for jQuery itself.
  • Bootstrap still uses it (though BS5 appears to be planning to drop this requirement). So, if you're using Bootstrap, you kind of have to use jQuery right now, and at that point, the point about space savings becomes more salient (and consistency is a good thing).
  • Some very widely used jQuery plugins don't have any particularly great equivalents that don't use jQuery. select2 is probably the biggest on e here (there are a number of alternatives to select2, but most don't have feature parity with it, and many have various small issues that are annoying to deal with which select2 does not).
  • Sometimes you still need a bit more than the regular DOM API's provide and don't want to work with something significantly more heavy-weight to get that functionality. jQuery is still decent ofr those cases.
  • It sill helps smooth over some of the peculiarities of different browsers. This is mostly of benefit to people who are forced to support IE, Opera Mini, BlackBerry, or iOS (yes, any iOS, not just old ones, it's got some of the same feature completeness issues that IE does).
Collapse
 
binyamin profile image
Binyamin Green

those are some good points. Thanks for sharing!