New features in jQuery 3


Point One

Version 3.1, released not even one month after the release of version 3.0, works differently in one case: In version 3.0, the jQuery developers converted jQuery.ready() and jQuery.fn.ready() internally to the new Deferred objects. They therefore also passed onerrors to the Rejection handler internally.

This caused a problem: If programmers supplemented a ready handler in the usual way – that is, with either of

jQuery(function() { ... })
jQuery(document).ready(function() { ... })

they were then unable to register a Deferred handler. Consequently, they learned nothing from an error (silent errors). To make matters worse, before version 3.1 programmers weren't able to identify uniquely whether the new Deferreds were suddenly pottering about under the hood.

jQuery 3.1, on the other hand, reports errors on the console by default. Programmers can control the behavior using the new method jQuery.readyException(). jQuery passes on any errors that occur in a ready handler to this method:

jQuery.readyException = function(error) {
  // each ready handler throws errors

To not block the execution of an application, jQuery.readyException() throws the error asynchronously and writes it to the console.

Slimming Cure

The developers have offered a "slim" variant of jQuery since version 3.0. It is missing the Ajax functions, the effects module, and the deprecated code. The minimized version of the slim variant (jQuery-3.1.0.slim.min.js) is about 17KB smaller than the minimized normal jQuery 3 (jQuery-3.1.0.min.js), which still carries plenty of weight at around 84.3KB.

Anyone wanting to upgrade from jQuery 2 to jQuery 3 should definitely read the jQuery Core 3.0 Upgrade Guide [7] beforehand. The jQuery developers also provide a Migrate plugin [8] on GitHub, which on the one hand issues a warning if you access functions that no longer exist in jQuery 3 or are considered deprecated. On the other hand, it simulates the behavior of jQuery 2, thus making it possible to revise web applications gradually.

Anyone who uses a framework such as Bootstrap [9] or a CMS like Joomla [10] needs to investigate which jQuery versions they use, because they often cannot be changed readily.


jQuery 3 is a logical development of version 2. The changes are limited, and the developers have discarded some of the code that has been deprecated for a while. So heaving a web application onto jQuery 3 shouldn't require that much work. However, with the minimized version at almost 85KB, jQuery 3 is still a hefty chunk. The jQuery team is now focused on further developing jQuery 3. However, the old versions 1.12 and 2.2 still receive bug fixes, so developers can address the migration in peace.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy ADMIN Magazine

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

comments powered by Disqus
Subscribe to our ADMIN Newsletters
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs

Support Our Work

ADMIN content is made possible with support from readers like you. Please consider contributing when you've found an article to be beneficial.

Learn More”>


		<div class=