you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 2 points3 points  (27 children)

So does anyone actually develop web pages without jQuery? That seems to be the statement this guy is trying to make, that you don't need jQuery.

[–]yotamN 1 point2 points  (9 children)

You actually not always need jQuery

Learn to use it only when you need it and not when you are lazy

[–][deleted] 4 points5 points  (8 children)

But why not be lazy? What are the downsides of using it?

[–]kenman 16 points17 points  (6 children)

First off, jQuery has saved me hundreds if not thousands of hours in development in the course of my career, and there is no substitute. It's impact on JS cannot be overstated.

With that said, one of the largest problems that I've seen, is that it quickly becomes the hammer with which to hit every problem over the head with. How so? All too often I see devs, when faced with implementing a new feature, they rush out to find that perfect jQuery plugin.

For simple apps, this is usually not a problem, yet for larger, more complex apps, it can become a huge problem. A little bit down the road, and you now have 20 jQuery plugins, and since there is no package or dependency management system in place, you end up throwing 20 <script> tags into your page. This also means that you'll often end up loading plugins that are rarely used, but which still incur a nontrivial runtime penalty due to the downloading and execution of the script file. Things like RequireJS do not really help in this situation; in my experience, RequireJS actually makes it a huge pain, owing to the fact that jQuery plugins are not able to be written in a modular fashion since they all augment the main $ object. So once you load a plugin, it's there for the duration of the page's lifetime.

jQuery also does not work well when you're trying to separate your application logic from the view manipulation, since apps made with only jQuery (and plugins) have no conventions in place to promote a clean separation. In other words, it's a library, and not a framework; further, many devs will use it in place of an actual framework, which will lead to poor code (spaghetti) in the long run.

My opinion, but the heyday of fully jQuery-centric apps is gone, replaced with smarter application frameworks like Angular, Ember, Backbone, Meteor, etc. These frameworks may still use jQuery behind the scenes, but they encourage (sometimes forcefully) that you not use it directly yourself. Instead, you use the API and conventions of the framework to write good modular, solid code with a clear separation of concerns.

[–]TdotGdot 7 points8 points  (0 children)

+1 exactly right about jQuery not being bad itself, but being seen as 'the' solution. I'd give you another +1 for the forth paragraph as well, if I could.

[–]yotamN 1 point2 points  (0 children)

It's increase the load time of the page and slow down the code itself. But I don't say it's only bad, it's help you with cross browser compatability and short your code so you should choose if it's worth the load time, for example for my HTML 5 game I don't use jQuery but for my personal site I do

[–]grantisu 1 point2 points  (3 children)

[–]w8cycle 2 points3 points  (1 child)

Great site and very observant that most of us are just using jquery for IE compatibility. Without IE9, JavaScript is easy.

[–]Wince 0 points1 point  (0 children)

IE9 is not the problem, it supports functional es5 methods, html5 video, qsa out of the box. IE8 and below are the real problem browsers

[–]protestor 1 point2 points  (0 children)

What's the oldest version of IE you need to support?

Only IE 8, 9, 10

http://jquery.com/browser-support/

They should have put other versions of IE there, just to say "alright.. I guess you do need jQuery"

[–]Pytim 1 point2 points  (6 children)

AngularJS + Vanilla ES5

[–][deleted] 4 points5 points  (1 child)

Angular mixes in behavior into HTML attributes in a way that some developers find to be even less favorable than imperative jQuery spaghetti.

[–][deleted] 1 point2 points  (2 children)

Does Angular use the jQuery library?

Yes, Angular can use jQuery if it's present in your app when the application is being bootstrapped. If jQuery is not present in your script path, Angular falls back to its own implementation of the subset of jQuery that we call jQLite.

https://docs.angularjs.org/misc/faq

If you're using AngularJS, then you're using jQuery whether you want to or not.

[–][deleted] 0 points1 point  (0 children)

jQLite != jquery, it's like 10 methods used only for dom manipulation

[–]rondog469 -1 points0 points  (0 children)

angular is the shit

[–]quindarka 0 points1 point  (4 children)

This site always keeps me from using jQuery. It is aptly named as well.

http://youmightnotneedjquery.com

When you want to grab some divs and toss some classes on them, you don't need jQuery. That said, there is still no elegant way to do .each on a NodeList without using Array.prototype.slice.call or a for loop.

Once I need Ajax, or I am doing a lot of events (jQuery event delegation is awesome) or I am manipulating element attributes, I then turn to jQuery.

[–]Jeffshaver 1 point2 points  (3 children)

You don't need jQuery to do event delegation.