3 ms·
> jQuery is largely not needed since Internet Explorer lost market share and there's less of a need to have lots of workarounds for it. As someone who's late t
by wraptile 4y ago
> jQuery is largely not needed since Internet Explorer lost market share and there's less of a need to have lots of workarounds for it.
As someone who's late to the webdev party I feel that jQuery is pretty awesome (all I ever heard is people poopoo it). The vanilla API for the DOM manipulation is just plainly awful and borderline nonsensical so I'd say jQuery is still very much needed.
- djitz 4y agojQuery and the many plug-ins people wrote for it were amazing. What was not amazing was the manner in which many projects utilized them.
- NohatCoder 4y agoThis is probably the biggest hole in vanilla js. In particular building a large DOM structure requires so many method calls. jQuery lets one use an innerHTML-ish style, but it is supposedly guarding against injection attacks in some way. I don't like the hand-wavy way it claims to guard against injections, as basically it has no way to tell what part of a string was meant to be text, and what was meant to be elements. So I ended up coding my own library. No conversion of strings to elements, so naturally no injections. Very small and simple. But saves a ton of typing when generating DOM structures in JavaScript: https://github.com/NoHatCoder/DOM_Maker https://github.com/NoHatCoder/DOM_Maker
- dspillett 4y agoIf you are mainly using jquery for its DOM manipulation¹ rather than for browser compatibility² or things that didn't exist consistently in older browsers³ then there are much smaller libraries that do that job which may be worth looking into. https://github.com/fabiospampinato/cash https://github.com/fabiospampinato/cash or https://github.com/franciscop/umbrella https://github.com/franciscop/umbrella to give a couple of examples. Some explicitly support IE11 so you are not dropping as much support for legacy browsers as you might otherwise. Though if jQuery works for you and isn't a performance issue, then by all means keep with it. It may not be ideal, but good enough and does the job. Let the naysayers spend their time debating whether you should or not, and just get on with making things! --- [1] selection engine, chained selections, chained modifications, … [2] not the issue it once was, if you can abandon IE and old Android browsers from your supported UAs or can deal with any issues that crop up individually [3] again, if you can afford to drop support for legacy UAs
- teknopaul 4y agoI'm a big jQuery fan. Some new frameworks that do DOM binding are just too "magic". Sometimes there is close to zero js code for a page, which, while cool, means it's hard to find out what to do to add new featues when the default behaviour is not what you want. With Jquery it seems the balance of writing code to make page active, and not writing too much code, is correct. I guess I prefer reading code than docs.
- dspillett 4y agoYeah, for what little front-end dev I do these days I prefer to keep the abstraction a bit more at the jQuery level. Quite a few of the mini-jQuery libraries, like the ones I linked to, are doing just that and allowing the sort of DOM manipulation it does but without all the other stuff.
- wraptile 4y agoThank you for the recommendations - cash looks awesome and more than enough for most of my projects!
- wil421 4y agoI don’t do front end work any longer but JQuery was the glue that held webpages together in the time of IE. Before the rise of Big Tech JS Frameworks it was the work horse getting things done in the browser while trying to have cross browser compatibility.