News for hackers. Stuff that matters.
Re:JQuery++ by laurent123456 on Friday August 05, 2016 @10:50AM (#12232734)
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.

Re:JQuery++ by overcast on Friday August 05, 2016 @10:54AM (#12232757)
Well 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.
Re:JQuery++ by imaginology on Friday August 05, 2016 @11:18AM (#12232953)
One 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.

Re:JQuery++ by k__ on Friday August 05, 2016 @11:21AM (#12232976)
True, I hope these pains will be gone with fetch.
Re:JQuery++ by nilliams on Friday August 05, 2016 @02:34PM (#12234761)
Unfortunately 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#issuec...

[2] https://github.com/ded/reqwest

[3] http://requirebin.com/?gist=8f13d5147c1c252ab1691115bfa8b7c5

Re:JQuery++ by k__ on Saturday August 06, 2016 @06:05AM (#12237629)
I don't know why they pushing Observables AND Promises in ECMAScript. Observables a much more flexible and don't have these problems :/
Re:JQuery++ by imaginology on Friday August 05, 2016 @11:24AM (#12233005)
That depends on whether the Promise specification gets cancellations. I like fetch's clean API, but being able to cancel my ajax requests is essential.
Re:JQuery++ by azernik on Friday August 05, 2016 @11:58AM (#12233306)
Cancel the requests, or cancel the callback chain that's set up to fire when they complete?
Re:JQuery++ by k__ on Friday August 05, 2016 @11:31AM (#12233067)
Essential? Why?
Re:JQuery++ by TheAceOfHearts on Monday August 08, 2016 @05:50PM (#12251122)
The big use-case I can think of is file uploads. If someone is uploading a large file, you wanna be able to cancel it.
Re:JQuery++ by Dayshine on Friday August 05, 2016 @11:22AM (#12232986)
>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?

Re:JQuery++ by overcast on Friday August 05, 2016 @12:16PM (#12233474)
jQuery 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.
Re:JQuery++ by Dayshine on Friday August 05, 2016 @12:27PM (#12233576)
I 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?

Re:JQuery++ by overcast on Friday August 05, 2016 @01:11PM (#12234037)
My 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.
Re:JQuery++ by debaserab2 on Friday August 05, 2016 @12:00PM (#12233327)
> 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.

Re:JQuery++ by overcast on Friday August 05, 2016 @12:17PM (#12233480)
Those 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.