Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

When you recommend updating jQuery/jQuery UI? Or in other words: what are the best practices for updating jQuery/jQuery UI?

I’m working on a long project that will take at least one more year. In that time span, I’m sure that jQuery/jQuery UI will be updated many times.

Do you recommend update my jQuery/jQuery UI files every time an update is released? Or is better to stick with a particular version until the end of the project?

I’m afraid of “breaking” code changes, and every time an update is released, I have to test everything. That takes too much time. But on the other hand, if I didn’t update, I’m afraid of bugs that later will bite me in the rear.

The project is an ASP.MVC and I use jQuery a lot.

Any thoughts?

share|improve this question

migrated from stackoverflow.com Oct 10 '11 at 3:24

This question came from our site for professional and enthusiast programmers.

    
This article may be relevant: it urges always being at the tip by linking to the Google-hosted version: encosia.com/… –  Alex Feinman Dec 17 '12 at 15:52

7 Answers 7

up vote 14 down vote accepted

Update your version of jQuery if and only if you need some new feature that's included in the new version. Simple as that.

If you frequently develop using jQuery, keep an eye on the official blog to know when updates are released and what they offer. Wait a couple of weeks or so before upgrading to the latest version to make sure any unexpected bugs get shaken out.

share|improve this answer
1  
+1 it's the most stable way to do it, upgrading for the sake of upgrading increases your overall development time when you end up fighting bugs. –  Nicholas Smith Oct 10 '11 at 12:47
2  
Also, keep an eye on your plug-ins. Sometimes a plug-in's bug fix requires upgrading the core jQuery code. –  Adrian J. Moreno Oct 10 '11 at 15:57
9  
I disagree with this answer. If the product is still in development, as it sounds like from the question, then upgrade with each new release of jQuery. If the product is in production, then I agree with this answer, upgrade only when an upgrade is required (bug fixes, new feature.. etc) –  Chuck Conway Dec 17 '12 at 18:13
    
@ChuckConway: Well said. –  Jim G. Jun 20 at 18:40

You should upgrade with each release of jQuery -- just take a peek at the update logs before updating.

The jQuery team is very good about documenting API changes, and -- even when the API does change -- it's not uncommon for them to support deprecated calls. At this point, the vast majority of the API is quite stable and probably won't change. Most changes are behind-the-scenes bug fixes that do not affect the outward API. This is especially true with the latest releases (1.8+).

Another great reason to update is because regardless of whether or not you remain on a project, that project will be maintained by somebody after you're done with it. Upgrading to latest version is beneficial for you, future developers and users -- because the newer versions of jQuery blow the older ones out of the water... so go ahead and update the thang.

share|improve this answer
2  
This should be the accepted answer, leaving it just means when you finally do want to upgrade you have to make larger version jumps which is much harder. –  Daniel Little Feb 11 '13 at 4:59

Do you need any of the new features included in a newer version of JQuery? Does your site work as expected today?

If you answered "no" to the first and "yes" to the second question, then don't upgrade jQuery.

If you DO need new functionality, then you have to balance this against the cost of increased testing and possible introduction of new issues.

If you have issues with your current version of JQuery, then a newer version may have fixed your issue, but you still have an increased test burden because you have to ensure the new version doesn't break anything else.

This is why having a good suite of unit, functional and feature tests is so essential.

share|improve this answer

Only you can decide if the risks are worth it. Personally, I like to stay up to date. However, i have had a few bugs introduced when upgrading that broke something (or caused odd behavior). Since you have a year of development ahead of you, chances are it will have to go through a final QA anyways.

I say keep up to date. It's much easier to do continuous small integrations than large ones all at once.

share|improve this answer

Upgrade as soon as you can without breaking anything. New functionalities, bug fix, new features are introduced in every iterations.

You might not need the latest features but when you do, you'll need to validate every new version in between what you have to make sure it doesn't break anything.

Small increment will allow you to keep everything up to date without having to upgrade 5 major releases and spend 5 hours testing everything at once.

share|improve this answer
1  
I'm still trying to figure out if updating from 1.4.x to 1.7.x will break anything. –  styfle Jul 17 '12 at 3:17

Test. Test, test, test, test, test.

I used jQuery UI version (then-current) on a project, and used an external plugin called .autocomplete that did type-ahead functionality, tying a text field to a JSON data source. Used it a LOT of places.

Then, months later, I needed to add a slider control that only came in a later-current version. Unfortunately, that later-current version added a native autocomplete function, which they claimed was the spiritual successor of the plugin I'd used, but which used entirely different methodology, functions, and data requirements, breaking the autocomplete fields on every page I used my new slider on.

Because the pages I was developing this new feature on didn't use autocompletes, I didn't notice. Because my client was in a rush to get this feature up before a trade show, it got rushed through staging and testing, and got into production with a crapton of broken autocompletes.

Ultimately, it was a failure of MY testing. And the lesson learned is, jQuery and jQuery UI have very little interest in backward compatibility. Which puts the requirement on us, as devs, to test and test and test.

share|improve this answer

In my experience, new versions of jQuery are generally more rigorous in their code cleanliness requirements regarding the calling code (your code).

There are numerous items that have been made deprecated ( http://api.jquery.com/category/deprecated/). There is no deprecated-since tag on the page, unfortunately. Older deprecations are more likely to break something.

Most notably (to me), the :checkbox selector and the toggle() function have been deprecated. Some time ago, this change has affected my own (oldest) jquery code. I did not this realize for a while.

On the other hand, newer jQuery releases usually come with substantial performance improvements. Check the changelogs, or maybe one of John Resig's presentations to see where the performance improvements were realized. If you would get any benefit from them... that's up to you to decide.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.