Why use jQuery 2?

I’ve been personally migrating away from using jQuery on projects where IE 8 isn’t being supported (which is most of them now). While there are some verbose bits in pure javascript (needing a regex to remove class names), for the most part it runs cleaner and faster so, why use jQuery 2 since it doesn’t support IE 8 either?

How much IE8 is there still out there these days? I’m assuming a sizeable rump still. That said, we’re still stuck with IE9 where I work - I’ll not mourn its passing.

What about using classList to remove class names?

el.classList.remove('someClassName');

Oh yes, answering my own question, we can see from http://caniuse.com/#feat=classlist that classList isn’t supported on IE9 and earlier, requiring a polyfill to work on IE8 and IE9.

So am I (IE 9 stuck) but IE 9 has several critical EMCA 5 components.

Heh, no worries, I’ve done that too. Most EMCA polyfills are smaller than jQuery 2 though.

I’ve always wondered with these things as to how small a percentage of legacy browser users developers need to take account of, before a decision is taken to stop supporting that particular version. After my earlier comment, I went and looked up a recent set of stats for browsers, and it was suggesting that there were only around 2.7% of users left on IE8. A small percentage maybe, but out of however many millions, that’s still quite a few people. The question then comes as to how many of those 2.7% are in your target market - I suspect those figures are a little harder to get at.

At my workplace we use Google Analytics and handle the decision on a site by site basis. IE 8 drops below 1% we raise our fee to support it. To date I think one client has agreed to pay the IE 8 surchage.

Actually jQuery 1 supports IE6+, whereas jQuery 2 supports IE9+. The idea is to use jQuery 2 when you don’t care about < IE9 to take advantage of the significant (more than 10%) file reduction.

jQuery 2 is also designed to be modular (like jQuery UI), so you can remove any of the features you know you’ll never use…I think you can squeeze it to below 10Kb if that’s your thing.

All being siad, jQuery 2 is actually slower performance wise: http://jsperf.com/jquery-1-x-vs-2-x/19

I’m not planning on abandoning jQuery on a whim - it s served me well. I just haven’t had the occassion to use 2 yet cause IE 8 has been on the support list. I recently had a pair of projects where all I needed to do was toggle classes and add event listeners, and this is easily done in straight JS if IE 8 doesn’t have to be accounted for.

It can be done relatively easily with only a little more code even if IE8 does need to be accounted for.

Yeah, but it’s just not worth the time to me at that point. If I have to use more than one invocation model I start looking for a shim or framework. I’m lazy.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.