Tuesday, May 10, 2011

jQuery 1.6 introduces breaking change

On May 3, jQuery introduced a new version that breaks some of the functionality of Gallery Server Pro 2.4.6 and higher. Earlier versions are not affected. Also not affected is the Gallery Server Pro DotNetNuke Module, *unless* you explicitly changed the default jQuery settings. The good news is there is an easy fix I describe at the end of this post.


Gallery Server Pro uses jQuery to provide a rich user experience. Starting with 2.3.3750, a default installation of GSP uses the Google hosted versions of the jQuery library rather than a locally stored copy of the .js file. This allows the browser to use a previously cached copy of jquery, resulting in a faster loading page.

There are a number of ways one can construct the URL to point to Google’s copy of jQuery. Here are a few examples of how I’ve tinkered with the URL:

2.3.3750: http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js

2.4.0: http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js

2.4.5: http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js

2.4.6 – 2.4.8: //ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js

Notice how the version number is specified. By omitting the minor version from the 2.4.6 and later releases, Google automatically serves the latest 1.X release. You get the benefit of having the latest version of jQuery without having to explicitly upgrade.

But there is some risk with that approach, which brings me to the topic of this post. On May 3, jQuery released version 1.6. It contains a number of improvements and performance enhancements. Unfortunately, it also introduces a breaking change that causes an immediate problem on all 2.4.6 and higher Gallery Server Pro releases. Earlier GSP versions are not affected because the jQuery URL pointed to either a local jQuery file (versions earlier than 2.3.3750) or one of the 1.4 versions. jQuery 1.6 changes how attributes are handled. The details are in this blog post, but what it means to GSP is that the handling of checkboxes and the enabling/disabling of HTML elements in several of the admin pages are broken.

For example, as user happylynlyn pointed out yesterday in the forum, selecting the option ‘Override the following default settings’ on the Gallery Control Settings page no longer enables the child options. This issue also affects the Manage Roles, User Settings, and Metadata pages.

The issue only affects these few pages in the site admin area – browsing the gallery and performing tasks in the gallery (add/editing objects, etc) are not affected.

The Fix

I will have this resolved in the next release. Until then, there is an easy workaround – just tell Gallery Server Pro to use an earlier version of jQuery. On the Site Settings – General page, update the jQuery path to specify version 1.5:



Marc said...

Nice article. Didn't knew about that version number naming.

Carlos said...

Hello from Spain.
I had to change those google api urls to a local downloaded version of the jquerys.
If the computer that is loading the gallery does not have internet connection, those urls produced a long latency on the page loading.
Thank you for this great app.!!