News for hackers. Stuff that matters.
Re:You might not need jQuery by chavesn on Thursday January 30, 2014 @01:53PM (#7152567)
Fantastic point. Abstractions can be dangerous because they often aren't developed right.

But that isn't the case here. When something like jQuery comes along, hiding so many gory details, and has been tested to death both in development and in production use all over the world, we are all better off because we remove so much failure surface area from our code.

Re:You might not need jQuery by diminish on Thursday January 30, 2014 @02:16PM (#7152736)
Browsers of the world, please embed, compile and cache last few versions of JQuery upfront. That's gonna speed up the whole navigation experience.
Re:You might not need jQuery by nswanberg on Thursday January 30, 2014 @02:30PM (#7152814)
Re:You might not need jQuery by jerf on Thursday January 30, 2014 @02:32PM (#7152826)
As near as I can tell, browsers are already at least sometimes caching compiled representations of JS; the win from shipping specific versions of jQuery would be minimal, and not work unless you used specific CDNs anyhow.
Re:You might not need jQuery by sfeng on Thursday January 30, 2014 @01:58PM (#7152605)
The question is, how many of those gory details still exist in modern browsers? There's not much to test if you're just calling el.classList.add().
Re:You might not need jQuery by dmethvin on Thursday January 30, 2014 @02:19PM (#7152757)
More to test than you thought. That just broke more than 20% of the Android installed base, since Android 2.3 doesn't work with classList.
Re:You might not need jQuery by wyuenho on Thursday January 30, 2014 @04:24PM (#7153447)
A classList polyfill is like 500b compressed. No need to blow a non-existent problem out of proportion.

https://github.com/remy/polyfills/blob/master/classList.js

Re:You might not need jQuery by kayoone on Thursday January 30, 2014 @04:57PM (#7153596)
are you serious ? thats actually a good example on why you should use jquery. First of all the dev needs to know exactly on which platforms he will run into problems and how to solve them...And what if you need not one but several polyfills ? That gets messy pretty quickly.
Re:You might not need jQuery by wyuenho on Friday January 31, 2014 @12:24AM (#7155424)
Ah no. First of all, you should always know which platform you target and what works and what don't work on those platforms, even if you are using jQuery. jQuery is not perfect. Platform specific corner cases are still exposed to you.

What if you need several polyfills? Drop them in too. You should always know what browser feature you are using. The same argument goes for using libraries. What if you need more than jQuery? Bring them in too. There are asset pipelines and/or pure front end packaging solutions like AMD to help you. What's the problem?

Re:You might not need jQuery by lmm on Friday January 31, 2014 @05:07AM (#7156051)
> You should always know what browser feature you are using.

Why? If I just drop jQuery in and treat that as my API baseline, what do I lose? A little performance, a few hundred kilobytes' download (almost certainly cached from a CDN anyway). And it frees me up from remembering a bunch of corner cases and keeping track of a bunch of implementation details, letting me focus my attention on more important things.

Re:You might not need jQuery by nostrademons on Friday January 31, 2014 @12:18PM (#7157757)
You can certainly use JQuery as your API base if you're willing to take the hit on performance and a few hundred KB download, and are willing to take that hit on every project you write.

The problem is that this shuts you out of a lot of hot, emerging markets that can be quite lucrative. You will never work for Google (as a front-end engineer) if you only know JQuery and not the native DOM APIs. Your mobile HTML5 apps will suck and will lose out to native counterparts in the app store. You're at a disadvantage in any competitive web market where people bounce from the website if it's too slow (there are more of these than you think).

If you're willing to limit yourself in this way, sure, go for JQuery. There is still a pretty booming market for Intranet apps or progressive-enhancement mostly-static sites where JQuery is just fine, and it provides a nice productivity boost for those use-cases.

The advantage of polyfills is that they give you flexibility and let you push the edge of technology today, and then they don't become obsolete tomorrow. As the web evolves you just get rid of the polyfill and you already know the latest & greatest of tomorrow. That lets you push into the emerging new markets that can be quite lucrative, at the expense of actually learning the (sometimes hard-to-use) APIs on the bleeding edge.

Re:You might not need jQuery by nswanberg on Friday January 31, 2014 @04:37PM (#7159338)
That makes a lot of sense especially in areas where you are competing for people's attention. If you aspire to being a front-end engineer it'd be silly not to know the DOM APIs inside and out, especially now that browsers have such nice dev tooling.

But for those aspiring to create big things another approach is to find a niche where you can offer something exclusive that people want. Thefacebook offered something that students would have put up with > 1s load times to see that they couldn't reliably get anywhere else. http://en.wikipedia.org/wiki/File:Thefacebook.png

Re:You might not need jQuery by wyuenho on Friday January 31, 2014 @06:17AM (#7156188)
The point is, jQuery doesn't free you up from remembering lower level details, they are still there in your face all the time, especially when it comes to event delegation and handling. jQuery also doesn't help you with CSS, which is even more of a pain than DOM inconsistencies. The whole point of polyfills is to patch browser incompatibilities, often times without losing any performance to newer browsers, so you can provide the best experience to half the people in the world on newer browsers and a mediocre experience to the rest, instead of a mediocre experience for everyone. If you care about attention to details, you should understand what your browser is doing. Polyfills are things that you only have to learn once and drop in once. Isn't providing a good experience one of the more important things?
Re:You might not need jQuery by talmand on Friday January 31, 2014 @10:49AM (#7157229)
Actually, jQuery can help with CSS inconsistencies, much the same way vanilla Javascript can, if you have the mind to use it that way.

You seem to be laying much of the "mediocre experience" on jQuery in this case. I would like to know why you feel this way. Seems to me that loading in polyfills for every browser inconsistency can lead you to the same problems you feel exist with jQuery.

I don't just care what my browser is doing, I care what all of them are doing; which often leads to using jQuery. Depends on the project and the number of expected browsers involved.

Polyfills are things you learn once and drop in once? So is jQuery.

What if the best experience to be provided suggests using jQuery? Would you use it?

All in all, to use or not use jQuery often depends on the project. If it fits, use it; if it doesn't, don't use it.

Re:You might not need jQuery by rwaldron on Thursday January 30, 2014 @06:06PM (#7153993)
...Which is an argument in _favor_ of jQuery.

You silly goose!

Re:You might not need jQuery by Jakob on Thursday January 30, 2014 @04:23PM (#7153445)
And style.display='block' for jQuery.show() does not work with <tr>'s (which need 'inline-block') and rules which have an !important clause in the CSS (which need to first set the display to empty string and then set it again).
Re:You might not need jQuery by tghw on Thursday January 30, 2014 @02:03PM (#7152643)
Define "modern"? IE8? Older Android browsers? How much compatibility are you willing to give up?