5 ms·
This youmightnotneedjquery.com website is nice but I'd be more interested to know what features are available in jQuery but currently missing from vanilla JS.
by laurent123456 10y ago
This youmightnotneedjquery.com website is nice but I'd be more interested to know what features are available in jQuery but currently missing from vanilla JS.
At the moment, I get the feeling that if I start with vanilla JS, at some point I'll need features that only jQuery provide, so I'll either have to reimplement them in my project, or backpedal and add jQuery.
- overcast 10y agoWell technically nothing is missing from vanillas JS, as jQuery is written in JS. I'd be REALLY interested to hear what you're doing that you couldn't do fairly easily without jQuery. Majority of users are doing basically selectors, setting attributes, ajax, etc. All easily done without it.
- imaginology 10y agoOne reason I still use jQuery is because its ajax() API is much nicer than the XMLHttpRequest API. Edit: another reason: slideUp() / slideDown() are very useful and not easy to implement with native code.
- k__ 10y agoTrue, I hope these pains will be gone with fetch.
- imaginology 10y agoThat depends on whether the Promise specification gets cancellations. I like fetch's clean API, but being able to cancel my ajax requests is essential.
- k__ 10y agoEssential? Why?
- TheAceOfHearts 10y agoThe big use-case I can think of is file uploads. If someone is uploading a large file, you wanna be able to cancel it.
- azernik 10y agoCancel the requests, or cancel the callback chain that's set up to fire when they complete?
- nilliams 10y agoUnfortunately Promises need to be fixed before fetch will be sane and here's how the promises spec currently looks: - unhandled errors silently swallowed [1] (this is the case for the most popular polyfill [1] too - the one recommended by fetch polyfills, BEWARE [3]) - no 'finally' method, despite pretty much everything in a UI needing some common 'cleanup' after e.g. a fetch() - not cancellable Right now you're better off with `$.ajax` (maybe make a custom build of jQuery) or a promise-like library like reqwest [2], rather than fighting with fetch. [1] https://github.com/stefanpenner/es6-promise/issues/70#issuecomment-223898502 https://github.com/stefanpenner/es6-promise/issues/70#issuec... [2] https://github.com/ded/reqwest https://github.com/ded/reqwest [3] http://requirebin.com/?gist=8f13d5147c1c252ab1691115bfa8b7c5 http://requirebin.com/?gist=8f13d5147c1c252ab1691115bfa8b7c5
- k__ 10y agoI don't know why they pushing Observables AND Promises in ECMAScript. Observables a much more flexible and don't have these problems :/
- Dayshine 10y ago>All easily done without it. I think that's the thing. Unless you write your own utility library or use someone else's it's often more verbose, more fragile and less intuitive. And if you do use a library, probably one for each feature, why is it better to have a handful of dependencies than one?
- overcast 10y agojQuery has its uses, many uses. But for the ones stated above, it's just not needed. People are including a large library on their site, to use a couple functions. Use the correct tool for the job.
- Dayshine 10y agoI would rather have one single large dependency than a handful of small, regularly abandoned, ones. In a year I will be able to reach out to the community for support on jQuery. Will I for all of these small tools?
- overcast 10y agoMy original post was ditching jquery for native JavaScript. Nothing to do with additional libraries. Except for Lodash which is very specific to some complex things I'm doing that jquery wouldn't help with anyhow.
- debaserab2 10y ago> I'd be REALLY interested to hear what you're doing that you couldn't do fairly easily without jQuery. Cross browser compatibility and legacy IE support.
- overcast 10y agoThose query selectors are supported back to IE8/9. As always, if you need it, obviously use it. I'm referring to including it by default, just because you've always included it by default.