Live data from Hacker News

You Don't Need JQuery

blog.garstasio.com

111–120 of 201 posts

Re: You Don't Need JQuery

#112
post #105

Earlier quoted context omitted.

I care as much for Android 2.x as ie below 10.

And probably 80% of our startup's revenue comes from banks stuck using IE8.

Is there a http://mapthebanks.com / https://news.ycombinator.com/item?id=8753565 for tracking technology organizations use?

Re: You Don't Need JQuery

#113

Earlier quoted context omitted.

jQuery is usually cached in your browser because of how common it is. From what I understand, the slowing is negligible. Part of a developer's role is to mitigate site performance with the speed of process. Inlining of critical CSS is one way to balance out initial page load, for example.

This is part myth. The chances your site has the same version of jQuery that the visitor's browser cache is are pretty low. iirc, someone once said it was less than 5%.

most of the time, it's less than 1% http://www.stevesouders.com/blog/2013/03/18/http-archive-jqu...

Re: You Don't Need JQuery

#114
I don't need power steering or an automatic transmission in my car either. And I don't need a garage door opener or a microwave. I don't need a wifi router... I can hard-wire my whole home. There are many things in this life that I do not NEED, but that make life easy. jQuery fits into this same category.

Re: You Don't Need JQuery

#115

Earlier quoted context omitted.

and slowing down your website

well that's the trade-off, isn't it? unless my app is speed-heavy, i'm not gonna spend the extra man-hours needed (that jquery saves me) so that website runs negligibly faster.

good luck ranking in google and explaining your self to your md when your major publishing site takes 20 seconds to load I wont mention any names but I know of two cases of this.

Re: You Don't Need JQuery

#116

Every time I try to build something without jQuery, I regret it. Not because of selectors, that's (sometimes) easy to do for lots of (basic) selectors. Not because of DOM manipulation, as long as you're willing to sacrifice simplicity and readability, you can build iterative loops to modify a collection of HTML elements. No, it's the unexpected things that cause me pain. Want to use event handlers on dynamically gene…

Life is definitely too short to not be using npm, browserify and React! https://www.npmjs.com/package/browserify https://www.npmjs.com/package/react And then use just what modules you need. All the functionality of jQuery has already been ported to various modules. https://www.npmjs.com/package/extend https://www.npmjs.com/package/promise https://www.npmjs.com/package/serialize-form

I really really want to use all of these new tools, and to a certain extent I already do, but they just seem like layers of overhead on top of other layers and by the time you get down to doing what you need to do, jQuery is just much simpler.

Re: You Don't Need JQuery

#117
post #7

You can basically sum up this entire rather ridiculous site with "Yes, you don't need jQuery, you can just use the built-in methods, but using jQuery is generally more pleasant, more consistent, and involves less typing". One particularly egregious example from the site: $('#foo').removeClass('bold'); vs. document.getElementById('foo').className = document.getElementById('foo').className.replace(/^bold$/, ''); The au…

Perhaps I'm being a bit dense (I've done prettymuch no front-end JavaScript), but since className gives a single string with class names separated by spaces[1], won't

    document.getElementById('foo').className = 
      document.getElementById('foo').className.replace(/^bold$/, '');
fail if the element in question has more than one class? In that case, you'd need to get the className attribute, split it by spaces, do the replacement in the resulting array, and then join back and assign, I believe.

[1]: https://developer.mozilla.org/en-US/docs/Web/API/Element.cla...

Re: You Don't Need JQuery

#118

This guy's argument is strikingly similar to that of the one made by those people who are anti-Apple, despite the fact that working with Apple products is a commonly pleasant experience, simply for the fact that they're Apple. Just because a lot of people use something that they're not being forced to use doesn't necessarily mean that they've been "tricked" into doing so.

Using Apple products is a pleasant experience. Using jQuery is to avoid learning how to code while purporting that it makes things easier cross browser. Of course, if that were the real reason, we would also have cQuery and c++Query and so on but, instead, we just learn how to code.

In your c and c++ analogies, what are the inconsistent DOM API implementations?

Re: You Don't Need JQuery

#119
I thought it was a joke site, I scanned the first example and saw the single jQuery way of doing something followed by n other ways depending on the browser / IE level.

Re: You Don't Need JQuery

#120

The AJAX examples fall a little flat. Yes, .ajax is a wrapper, and it was written because the API for XMLHTTPRequest is needlessly complicated and verbose. If you're developing a single page application, you only load jquery once, then do the rest with AJAX calls for JSON and assets. It's worth the <100 KB on initial page load, at least for the projects I've worked on.

Not to mention that if you're loading jQuery via a CDN, there's a good chance that your end user has it in their cache already.
Post reply on HN