Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Upgrade jQuery 1.4.2 to 1.9.1

Tags:

jquery

upgrade

We have been using jQuery 1.4.2 in our web application. Recently it was suggested that we upgrade to a newer version. So far we are thinking about upgrading to 1.9.1 as we need to support IE7 and IE8. Our application uses bunch of plugins e.g. fancybox, cookies, tipsy, jcarousel and bunch of others. Plus we have a lot of script files, probably around 50 files. and then some scripts embedded withing the files. I feel like this is going to be a disaster! Does anyone have any advice? We are not set on yet upgrading to 1.9.1. If I want I can convince the managers to upgrade to a different version. What is our safest bet? Please advise.

Thank you!

like image 785
sayayin Avatar asked May 13 '13 03:05

sayayin


People also ask

Is it safe to upgrade jQuery?

Updating jQuery may break your site You won't get any compile errors, but have to test the whole site. This means the risk of updating jQuery is pretty big. Even though it may seem like a big undertaking, jQuery Migrate helps you to find any changed interfaces and let your old code work with a newer jQuery version.


2 Answers

Just look at the deprecated functions still in your code; the big ones to watch out for are .live() and .delegate() which have been replaced with .on(), .attr() for which .prop() is the replacement, and .browser(). I've been updating my code as new versions came along and it's been pretty easy (about 20K lines of js) so you shouldn't have any problems. Just start with the functions I mentioned and I think that'll solve most of the issues. Then, look at the Migrate plugin.

like image 198
frenchie Avatar answered Sep 26 '22 06:09

frenchie


You can try to use jQuery Migrate plugins which is used to detect and restore APIs or features that have been deprecated in jQuery and removed as of version 1.9.

like image 24
Eli Avatar answered Sep 26 '22 06:09

Eli