Upgrading jQuery to 1.9.1 in Kentico 7 and 8

Nathan Eary asked on July 16, 2014 16:01

This is not a question. I have found success in upgrading the core jQuery library to 1.9.1 so that the latest versions of Kendo and other 3rd party libraries can be used without issue.

In order to do this, it was required to upgrade both jQuery and jQuery UI due to a bug in jQuery UI made where it had overwritten jQuery.fn.outerWidth and jQuery.fn.outerHeight and had them returning jQuery selector objects instead of integers.

Here are the versions you need jQuery v1.9.1 jQuery Migrate 1.2.1 jQuery UI 1.8.23 - it is crucial that you use this older version because later versions change the dialog api and do not work with the CMS.

Upgrade procedure:

  1. Inside CMSScripts/jQuery/jquery-core.js and between the sections marked "CMS", place the code for jQuery 1.9.1 and immediately after that code place the code for jQuery Migrate 1.2.1

  2. Replace the code in CMSScripts/jQuery/jQuery-ui.js with the code from jQuery UI version 1.8.23

Dear Kentico Devs - In future releases, it would be better if you were to create your own copy of jQuery and name it something different (maybe kQuery) so that we can actually choose to use your version by doing something like "window.jQuery = window.kQuery" or we can choose to load our own without conflict. Some 3rd party tools use "jQuery" instead of "$" in code that we either can't change or don't want to change because it complicates maintenance, so simply putting the CMS jQuery into no-conflict mode is not always sufficient.

Recent Answers


Nathan Eary answered on July 16, 2014 16:06

This will likely work for older versions of Kentico as well.

3 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on July 16, 2014 19:43

Nice find Nathan! Good to see you around, drop me a note if you have time.

0 votesVote for this answer Mark as a Correct answer

Ales Kalina answered on July 22, 2014 09:27

Hi, Nathan, thank you for valuable contribution. The solution you propose is exactly what we implemented in version 8.1. Kentico custom version of jQuery is registered in "no conflict" mode and is available only in global $cmsj variable. As a result you are free to use any version of jQuery or jQuery UI that suit your needs.

We would like to upgrade jQuery to more recent version, but because of strict requirements for backward compatibility of minor versions we have to wait for version 9.

0 votesVote for this answer Mark as a Correct answer

Brigid Kearney answered on July 25, 2014 21:29

@Ales Kalina, wondering if there is an interim fix that would allow us to seamlessly use our own version of jquery (version 1.11) prior to the August 22nd release of 8.1?

0 votesVote for this answer Mark as a Correct answer

Nathan Eary answered on July 25, 2014 21:34

@Dawn Stanford

By using the jQuery Migrate like I described, you should be able to upgrade jQuery to 1.9+, but probably not jQuery 2.x. Seeing as how jQuery 2.x does not support older browsers, I doubt you would want to do that at this time anyway.

0 votesVote for this answer Mark as a Correct answer

Nathan Eary answered on July 25, 2014 21:37

@Dawn Stanford by 1.9+ I mean 1.x, which includes the latest 1.11 release at this time. You should still be able to use the same version of jQuery migrate

0 votesVote for this answer Mark as a Correct answer

Ales Kalina answered on July 30, 2014 17:39

@Dawn Stanford, that depends on your requirements. You can always register the required version jQuery in "no conflict" mode and use your custom alias. As a result it might be necessary to rewrite some jQuery plugins you use, but this effort is negligible compared to updating Kentico JavaScript code that uses jQuery. However, if rewriting jQuery plugins is not feasible, your options are quite limited. If you can avoid Kentico web parts that require jQuery, you are free to use any version of jQuery you like. Likewise, if you can avoid jQuery plugins that require jQuery or $j aliases, you can register jQuery in "no conflict" mode and restrict it to the $ alias only.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.