All Articles Review
Review: jQuery 2.0 New Features
Tareq Fadel on Sat, November 9th 0 comments
jQuery got a massive update earlier in 2013 and the big news is the improvement in the library. Tareq Fadel takes a closer look at what's changed and how it'll affect you in your web projects.

The latest update to jQuery has been the biggest update since the release of jQuery itself. jQuery was released upon us on the 26th August 2006 and seven years later, the biggest release, jQuery 2.0 was released 18th April this year. Currently we’re on release 2.0.2 after a couple of bug fix releases.

Now why is this release such a significant release? Even the creators of jQuery see this as a significant release, hence the big 2.0 versioning number that was given to jQuery. This new jQuery is the same jQuery as we know plus some added features, but the difference is that the library is new, built from the ground up. It was built with current and future browsers in mind with no support to older browsers.


No OldIE ?

Ie8logo.png


Reading what they have to say on their blog that jQuery 2.x will not be supporting oldIE, this being Internet Explorer 6, 7 or 8. This is a big and brave move from the developers of jQuery. There’s been a big uproar to this and how could they cut out a big chunk of internet users from their product release cycle?

The guys at jQuery had realised that the number of users of oldIE has been dwindling and the rate that these users are dropping is increasing. More and more websites are designing for modern browsers only with the advent of HTML5 and CSS3. For example, Google as a company when they release a new product through their services, they only release it for current and previous version browsers. Look at the new Google Maps which was only released a couple of weeks ago, this was tested and made to work on Internet Explorer 10 (current release) and Internet Explorer 9 (previous release), if looking at one browser vendor. Which means that it doesn’t work on IE8, 7, or 6 as intended.

The reason for this big change from jQuery is because they’ve always been supporting older browsers in their framework. And as the framework has grown over the years, its supported more and more features and these features have become more and more complex. To get these working on older browsers involves a lot of effort and maintenance. It’s just got to the stage where it’s becoming unsustainable to maintain support for the older browsers. Plus, a lot of the new features which are utilizing HTML5 technologies that are being released are just not possible to support in older browsers.

This doesn’t mean that they’ve completely dropped support for older browsers. If you’re looking to add jQuery to your site with older browser support, then you can download jQuery v1.10.1 and they’ll carry on release updates and bug fixes to the v1.10 but no major updates will be added to this fork. All new updates will be added to the version 2.0 release of jQuery. Now both v1.x and v2.x can work together. You can coincide both libraries to allow the developer to utilize the new features of jQuery 2.x for the modern browser and use v1.x for the older browser support. The danger in that is that you’re including 2 frameworks which increases the load on the user from a filesize perspective.


Smaller File Size?

Another reason why they’ve decided to drop support for oldIE is that there was a lot of codebase that was in the original jQuery that was just there for older browser support. Taking this out has caused the jQuery 2.0 code to be so much lighter which is always a benefit when developing for mobile. In comparison between jQuery 2.0.2 and jQuery 1.10.1 is a reduction in size by 11.45% down to 82Kb minified and gzipped.

Because there is still a lot of users out there use oldIE, the developers recommend to use both v1.x and v2.x simultaneosly. Where they recommend to use jQuery 2.0 solely is when developing non-web-site scenarios.

Here’s the official list of recommendation scenarios:

  • Google Chrome add-ons
  • Mozilla XUL apps and Firefox extensions
  • Firefox OS apps
  • Chrome OS apps
  • Windows 8 Store (“Modern/Metro UI”) apps
  • BlackBerry 10 WebWorks apps
  • PhoneGap/Cordova apps
  • Apple UIWebView class
  • Microsoft WebBrowser control
  • node.js (combined with jsdom or similar)

As you can see, these are pure HTML5 environments which wouldn’t ever need support for oldIE.


Custom Builds

Build.png


This is a very welcome new addition to jQuery where you can customise what you want and not want to include in the build of jQuery. This allows you to reduce the filesize further by omitting all the features that you hadn’t used at the end of your project. In a lot of cases, I never use all the features of jQuery in one project or another. In some cases you may have only used less than 10% but you’d need to include the whole build which increases filesize unnecessarily. If you’ve used Modernizr before, you’d understand how useful this has been for developers. As the framework grows in size with more additional powerful features it may come to a point that it’s too big to include in any site and by using the custom build feature you can scale it back down to an acceptable level.


Same API

api.png


To maintain consistency and not to have too much of an overhaul. They’ve made it compatible with what you’ve been used to in terms of documentation from version 1.9. For example, if you’ve been using one of their utility methods in a particular way in version 1.9, then this hasn’t changed and using it in version 2.0 will be exactly the same. It’s just how the jQuery will perform the action under the hood may be different. But to the end user of jQuery it won’t feel any different.

This is very important to make sure they don’t alienate the community or the users of jQuery. If they’d had a major overhaul over how you write jQuery then this may have been too big a move and caused a lot of users to shy away from it or not use it all together. As jQuery 2.0 develops and matures they’ll be slowly introducing changes to the API to adopt newer, better methods of applying the codebase to the users site.


Wrapping Up

At first glance looking at what’s new may not look like a lot but when digging deeper and looking under the hood but this is in fact a major overhaul for the framework.

Comments (0)

You must be logged in to comment.

Feedback
Course Advisor
Don't Know Where To Start?
Ask A Course Advisor
Ask Us!
Copy the link below and paste it into an email, forum, or Facebook to share this with your friends.
Make money when you share our links
Become a macProVideo.com Affiliate!
The current affiliate rate is: 50%
Classes Start Next Week!
Live 8-week Online Certification Classes for: