JQuery++
jquerypp.com
jquerypp.com
http://youmightnotneedjquery.com/
This also helps you to learn better javascript, rather than relying on a crutch to string together a lot of convoluted sugar syntax.
This comes with the big disadvantage of jQuery, everyone and their dog knows it and dogs are not great coders.
tldr; jQuery's success was not innovation or unification, it was an easy to pick up syntax. From there it was all inertia.
Did you mean "hire" or where you intentionally trying to make it sound like you're abducting programmers off the street and hiding them in your basement?
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.
Edit: another reason: slideUp() / slideDown() are very useful and not easy to implement with native code.
- 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
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?
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?
Cross browser compatibility and legacy IE support.
https://github.com/github/fetch
Among countless others. Please don't bring in all of jQuery if you're just going to use one function from it.
http://youmightnotneedjquery.com/
var request = new XMLHttpRequest(); request.open('GET', '/my/url', true);
request.onload = function() { if (request.status >= 200 && request.status < 400) { // Success! var data = JSON.parse(request.responseText); } else { // We reached our target server, but it returned an error
}
};request.onerror = function() { // There was a connection error of some sort };
request.send();
OR
Even better, you should just use a reactive front end framework. https://vuejs.org/ combined with https://github.com/vuejs/vue-resource is currently my fave.
Just use jQuery. Please.
vue.min.js is 75k. vue-resource.min.js is 13k.
So jquery is smaller.
I disagree that jquery's API is convoluted.
And what is wrong with sugar syntax? One can argue that most of es7 is sugar syntax, but we are happy to use it since it makes your code more terse while remaining readable
The last two products I've worked at has had an audience that includes individuals who either cannot or will not upgrade their web browser. They are stuck on whatever their IT department froze their browser version to year(s) ago. This could be internet explorer 9 or some ancient version of Firefox or Chrome.
The individuals in this circumstance always amount to what some might consider to be a negligible amount of people (Probably less than 2%), however, I've always been unable to construct a good argument for why we should be unwilling to support 2% of our customer base when using a good cross-browser compatible library like jQuery from the start can save the argument from even taking place.
I suspect this is more the nature of working on B2B apps than B2C, although I do wonder how many people are actually looking at the browser analytics of their audience when they are so willing to forsake jQuery for "vanilla javascript".
Sure, okay, I'll tell my CEO that 2% of our customers just don't matter, becuase - yanno, the progress of the internet needs to happen.
Or I could just use jQuery from the start and not think about this problem again.
I am an author of a jquery plugin (1KLOC) which I need to rewrite in plain js.
There is going to be a handful of things that when converted will need to become helper methods because its not a line to line conversion.
So now Ill be writing a small dom manipulation lib within my lib. This seems wrong to me, since every other thing converted from jquery to native will also need write their own little helper lib.
Now you import all these great native js libs into your project, and because native js code is usually a little bigger than jquery code, you end up with a bigger vendor bundle than if you had just used jquery and all your libs used it too.
what is the advantage of that?
I agree with a sibling comment, I would look for a small DOM manipulation library.
It's like saying "Using lodash is bad because then you don't learn real javascript and you rely on another big library to do the job for you".
Becoming an expert DOM manipulator in vanilla javascript won't make you a good developer. DOM manipulation is incredibly trivial but involves a lot of grunt work, and jQuery is just a utility lib that makes the grunt work easier. Just like lodash, moment.js or any other lib.
I think people are just super salty because jQuery is popular, everyone uses it, which means that a lot of bad developers use it, and bad developers produce spaghetti code - which means that jQuery is bad? lol.
You know there's a lot of morons who eat pizza, does that mean that ordering pizza once in a while makes you a moron?
Writing good or bad code has nothing to do with jQuery, lodash, React, or any other library.
If you're a shit programmer you will write shit code. If you're a good programmer you won't.
If you're rendering server side, you're going to use imperative DOM manipulation library - jQuery is a good choice.
If you're rendering client side, you don't need jQuery, you're going to use a rendering library.
I don't get why people have problems with grasping such simple concepts.
/rant
Can bootstrap work without jquery or isolate only the subset of jquery they use?
http://react-bootstrap.github.io/
https://github.com/ng-bootstrap/core
https://kaliber5.github.io/ember-bootstrap/
http://yuche.github.io/vue-strap/
https://github.com/donejs/donejs
Looks interesting. Has anyone tried this?
Also jQuery is so much intrenched into our computer infrastructure. You can even install it using your fav package manager `apt-get install libjs-jquery`.
The best we could do for a 'replacement' is a site that lets you pick which browsers you're targeting, which DOM APIs you want, and generates a polyfill.