jQuery upgrade
Jira 8.0 will include jQuery 2.2.4. While doing the upgrade ourselves, we've created some best practices to make it easier for you to update your add-ons. Apart from the changes listed below, we’ve also attached some useful links to official jQuery upgrade guides, if you needed more information.
Good to know
Versions
We're upgrading jQuery from version 1.7.2 to 2.2.4. We'll also include the jQuery migrate plugin 1.4.1 to simplify the upgrade. The migrate plugin will allow you to use deprecated features so that your code still runs properly on the upgraded jQuery. However, you should treat it as a temporary solution, and migrate your code fully, as we’ll be removing the migrate plugin in the next releases.
Security issues
jQuery 2.2.4 shipped with Jira will get two additional security patches to address the following security issues:
Change log and upgrade guide
We'd recommend that you have a look at the official jQuery change log and upgrade guide to get an idea of all the important changes and have some accurate information on hand if something is not clear.
- Change log: contains a list of changes in all jQuery versions.
- jQuery 1.9 upgrade guide: most of the changes were included in jQuery 1.9, and you can read more about them in this upgrade guide. Additionally, you can have a look at jQuery 1.9 blog post and migrate plugin 1.x.
Warnings about deprecated resources
After upgrading jQuery, the migrate plugin displays information messages and warnings whenever you use deprecated functions. These functions are still available and working, but since we’re planning to remove them in the future, it might be a good idea to change them to the supported ones. Warnings will help you identify where are you using them.
In the previous EAPs, warnings were enabled by default, but we’ve disabled them in the EAP Beta. If you want to display them again, enable the jquery-migrate-logging
module.
- Go to > Add-ons > Manage apps.
- Search for the
jquery
plugin. - Enable the
jquery-migrate-logging
module.
Changes
The tables below show the most important changes. This is not an exhaustive list, and you should review it together with the jQuery upgrade guide.
jQuery path changed in embedded issue collectors |
---|
The path to jQuery has changed in issue collectors. Specifically, in the code that allowed you to embed an issue collector outside of Jira. If you created one and embedded it by using the generated code, it will not work as the code is no longer accurate. |
Deferred.then |
---|
Before the upgrade, the then method was aligned to some degree with the Promise/A spec, and was used as syntactic sugar for attaching handlers on done and fail. Now, it behaves similarly to the Promise/A+ spec: it can change the value, and can be chained. |
isResolved, isRejected |
---|
This method has been replaced with deferred.state(), which returns one of the following states: pending, resolved, or rejected. Docs: deferred.state(), deferred.isRejected(), deferred.isResolved() |
selector,comma |
---|
The jQuery selector can't end with a comma. |
.closest(selectors) |
---|
The signature of the |
$.ajax{async:false} |
---|
Synchronous requests (SJAX) must use callbacks instead of Deferreds. Docs: jQuery.ajax(), enhancement request, alternative method |
state@syntheticClick |
---|
Before the upgrade, an event triggered by a click on radio/checkbox elements would see these elements in the opposite state than that of a user action. This has been fixed to reflect the same checked state as a user-initiated action. Docs: bugfix, jQuery 1.9 upgrade guide |
events@.fn.data |
---|
jQuery.fn.data() won't fire events (getData, setData, changeData) each time a data item is modified. Docs: bugfix |
namespace@.fn.data |
---|
jQuery.fn.data() won't support namespaced data. Docs: bugfix, jQuery 1.9 upgrade guide |
$.proxy |
---|
Preserve context when jQuery.proxy was called with a falsy context. |
$.contains |
---|
The first argument must be a DOM element, not a jQuery object. Docs: jQuery.contains(), alternative method: Node.contains() |
$.uuid |
---|
This method has been removed. Docs: jQuery 1.9 upgrade guide |
$.offset.bodyOffset |
---|
This method has been removed. |
$.browser.version |
---|
A way to recognize the webkit browser version has changed. In the case of webkit, the previous version of |
$.fn.width |
---|
A way to calculate the width of elements has changed. jQuery 2.2.4 returns different values for width (%) values on inline elements that have no content, so you should be extra careful when checking the width of these elements. Docs: width() |
$.focus() |
---|
The event handler won't be triggered if the elements on which you call |