What's new in jQuery Update 3.0?

by | June 3, 2015
jQuery write less, do more.

Share

TwitterLinkedinFacebookEmail

jQuery is a fast, feature-rich, JavaScript library that powers many of the user interface enhancements in Drupal. Progress bars, AJAX autocomplete textfields, vertical tabs, menus, and other dynamic elements all utilize jQuery to work their magic.

By default, Drupal 7 ships with jQuery 1.4.4, which was released nearly 5 years ago. Many fundamental updates have been made to jQuery in that time, such as the performance enhancements in 1.6better event handling in 1.7reduced startup overhead in 1.11, and let's not even discuss jQuery 2.0. And while Drupal may still be happy distributing jQuery 1.4.4, other modern technologies require more recent jQuery versions to operate. That means getting cutting-edge user interfaces and integrating Drupal with front-end frameworks like Angular can be difficult or impossible.

Ye Old jQuery Update

Fortunately the jQuery Update module provides an easy way to get a modern version of jQuery running on your Drupal site. After enabling jQuery Update 2.x, you’ll see a new “jQuery Update” link in the Configuration > Development menu that produces the following config page:

[[{"fid":"471","view_mode":"media_original","fields":{"format":"media_original","field_file_image_alt_text[und][0][value]":"","field_file_image_title_text[und][0][value]":""},"type":"media","link_text":null,"attributes":{"alt":"Screenshot of jQuery Update 2.5","title":"jQuery Update 2.5","height":"619","width":"785","class":"media-element file-media-original"}}]]

 

This is great! It lets us choose which version of jQuery to use, gives us the option to change the compression level, and load from a CDN. However, as I mentioned above, jQuery 2.x is out, and this only lets us select up to jQuery 1.10. What’s a future-forward Drupal dev to do?

New Hotness of jQuery Update 3.0

[[{"fid":"472","view_mode":"media_original","fields":{"format":"media_original","field_file_image_alt_text[und][0][value]":"","field_file_image_title_text[und][0][value]":""},"type":"media","link_text":null,"attributes":{"alt":"Screenshot of jQuery Update 3.0-alpha1","title":"jQuery Update 3.0-alpha1","height":"454","width":"785","class":"media-element file-media-original"}}]]

jQuery Update 3.x provides a few additions over the 2.x branch:

  • Ability to select up to jQuery 2.1.4. This comes with all the niceties from the jQuery 2.x branch.
  • A user-friendly user interface makes it easy to understand what kind of settings you're changing
  • Theme overrides allow you to select which version of jQuery to use on a per-theme basis, not just for administration pages
  • jQuery Migrate allows you to use older JavaScript code with newer versions of jQuery. If you're using jQuery 1.9 or higher with Drupal, I recommend that you use this.

Upgrade All The Things

jQuery 2.x comes with a lot of new features, and jQuery Update 3.0 allows you to take advantage of them. You will be glad to know that Drupal 8 comes with a lot of this out of the box, so take advantage of jQuery Update, and make some sexy JavaScript happen in both Drupal 7 and 8!

Thank You

As of this writing, there are 407,046 reported sites using jQuery Update. It's a big deal. This couldn't have happened without the work and dedication from Vitaliy BoborvSergey SemashkoBart VanderstukkenBastian Konetzny, Mark CarverRob DaviesMatt MikitkaRichard ThomasCooper FellowsAriel BarreiroberlinerPierre Buylersmylski, Eric Duran, and the many others involved in the jQuery Update queue. Acknowledgement is also owed to those who’ve helped fund this important work; Kalamuna has been a huge supporter giving me time and other resources to dedicate to contributions. Thank you, all, you make the Internet a better place.

Rob Loach

Rob Loach

Assoc. Director of Research & Innovation

When web projects get tough, the one and only Rob Loach just gets more emboldened. As a Assoc. Director of Research and Innovation with a keen interest in project management, he's an unstoppable double-threat who eviscerates all obstacles. Whether architecting complex web applications or leading a team scrum, Rob is always on the front-lines at Kalamuna.