U4-11407 - Upgrade jQuery to 3.x Latest

Created by Nicholas Westby 01 Jun 2018, 19:39:26 Updated by Nicholas Westby 01 Jun 2018, 19:39:57

Relates to: U4-10928

According to the bower.json file, Umbraco 8 is still using jQuery 2.2.4: https://github.com/umbraco/Umbraco-CMS/blob/temp8/src/Umbraco.Web.UI.Client/bower.json

That's problematic, as jQuery 2.x and lower have some bugs that interfere with PCI compliance. It would be nice if Umbraco 8 came with the latest jQuery out of the box (currently, that's jQuery 3.3.1).

BTW, if Umbraco 8 is anything like Umbraco 6/7, there are actually several references to jQuery (e.g., there is some install page that is using an older version of jQuery), so it would be good to find all references to jQuery and upgrade them to one version (the latest version). A couple examples include:

  • noNodes.aspx references both /umbraco_client/installer/js/jquery.1.4.4.js and /umbraco_client/installer/js/jquery.main.js, depending on the version of Umbraco. Other versions of Umbraco have this file reference https://code.jquery.com/jquery-latest.min.js.
  • install/default.aspx references both those same files

I did a bit of work myself for an older Umbraco install, and after upgrading jQuery I had to add a few hacks. Here are a couple of them in case they are of use to you:

// Fix #1. Add $.curCSS support back. // https://stackoverflow.com/a/29298828 jQuery.curCSS = function(element, prop, val) { return jQuery(element).css(prop, val); };

// Fix #2. Add $.buildFragment support back. // https://github.com/canjs/canjs/pull/2177#issuecomment-171430111 jQuery.buildFragment = function (data, context) { var items = $.parseHTML(data, context); var fragment = document.createDocumentFragment(); for (var i = 0; i < items.length; i++) { fragment.appendChild(items[i]); } return fragment; };

In jquery.fileUploader.js, I had to make this change:

//$.event.props.push('dataTransfer'); $.event.addProp('dataTransfer');


Priority: Normal

Type: Task

State: Submitted


Difficulty: Normal


Backwards Compatible: True

Fix Submitted:

Affected versions: 8.0.0

Due in version:


Story Points: