Which jQuery to use when upgrading app

Which jQuery to use when upgrading app

I'm looking at upgrading an app from V7 to V8. There are two jQuery versions 1.4.2 OS and 1.8.3. The V7 app under V8 has this set to 1.4.2 OS. Does/should this need to be changed? What's the advantage/disadvantage of using the newer version? My ultimate goal is to find a path to getting all of the older apps ready for 8.0.1.
Hi Gerry,

You'll have all the advantages of having a more recent version of jQuery, namely many components out there required a more recent version.
As a rule of thumb I would upgrade that but you should test that your component is not broken.
jQuery versions have a mostly compatible API, but sometimes there are some minor differences. My suggestion is to upgrade to the latest version so you have the most recent performance improvements and bugfixes.

There's a very small chance that you could be using some plugin that will break with the new jQuery version; so if after upgrading you notice a misbehavior you can try to downgrade it (or get a more recent version of the said plugin).

This way we make sure that upon an upgrade by default there's no chance for anything to break, and optionally you can change your eSpaces to use the better version.

The upgrade for us was pretty smooth, with the exception of two items which took a LOT of effort to make work (one of which the developers warned up front was not compatible with newer versions of jQuery). I ended up not upgrading one of them at all and just removing the functionality since out of over 500,000 uses of the overall feature, we had less than 200 uses of that particular function.

What makes a function not compatible with the newer version of JQuery 1.8?
Rebecca -

Honestly... not sure. From what I've seen the issues have been more with jQueryUI than jQuery itself, which has never given me grief.

Hi Rebecca,

The jQuery folks try hard to maintain compatibility between versions, but there are always some minor breaking changes.

Some things that come to mind:
  • The selector engine changed from jQuery's own engine to Sizzle, which tries hard to delegate as much work as possible to the browser's native document.querySelectorAll function, which means that if the browser misbehaves in some scenarios, jQuery might just throw an exception whereas before it would work correctly
  • The introduction of a distinction between prop() and attr() functions (see this SO thread for more details)
  • There were some changes in the way AJAX requests are handled that break advanced scenarios like intercepting answers
So all in all there should be no problems in most cases, but because that's not 100% certain we can't just perform the migration automatically. However, just like André said, there are a few advantages in upgrading everything to a more recent version of jQuery, namely because of bugfixes and significant performance improvements that were introduced, but also because many of the new jQuery plugins will require the most recent versions.