The 5 Emotional Stages of a jQuery Upgrade
null min read
The following post contains a emotional filled dialog between fictitious front-end developers "Frank Fowler" and "Mike Morris". In this drama filled exchange Frank decides to upgrade his current project to the latest jQuery release.


Frank: Ahh man, I just saw that jQuery 1.9 was released. Too bad my current project is still using the 1.8.3 release. Mike: Ohh bummer, sorry to hear that. I tested out the beta release of 1.9 that came out about a month ago and didn't have any issues.Frank: Really!?! Sign... I wish I could upgrade. I don't know if I can convince my boss to invest the time to upgrade and staying on an older version makes me a little sad.


Mike: You might consider upgrading. They've fixed lots of bugs, enhanced CSS3 support, and added several new features.Frank: I don't know. It is a big project and I don't know if I can risk all the extra testing. I'm glad that it worked out for you, but I may just have to stay on this old version while everybody else upgrades. Mike: Frank, an upgrade shouldn't be so bad. The jQuery team does a good job outlining the change log and they have over 6000 unit tests to ensure quality over a suite of browsers.Frank: Yeah, I guess you are right, but it is such a huge project. What if something goes wrong? Surely something will go wrong, right? I'm fearful that I won't be able to figure it out if there is an issue. Mike: Well, it wouldn't hurt trying would it?Frank: I guess you are right. Lets go head and give it a try.


Frank: Okay, I just added a reference to the jQuery CDN for the 1.9 release to my project. Here goes nothing...Mike: So, how did it go?Frank: Huh... WHAT!?! Nothing even works anymore! I knew I shouldn't have upgraded.Mike: Well, what exactly is breaking?Frank: Like I said, nothing works! What did jQuery do to this release? Are they trying to hurt the development community? The last version worked just fine for me. I don't know if I can trust this project anymore.


Mike: Now now, lets take a look at this together. Does your application use some of the features that jQuery deprecated?Frank: What!?! Deprecated? Umm, well I don't know. When did they deprecate features?Mike: A while back jQuery mentioned they were going to deprecate features like the .live() method and .browser sniffing.Frank: Ohh, I guess I didn't realize that. Maybe I should have read the blog post release notes more thoroughly :(Mike: Yeah, even though they deprecated those features jQuery hadn't removed them until the 1.9 release. So, maybe that is why some of your code is broken. I know you used to use .live(). Did you change your .live() to use the new .on() method?Frank: Yeah, I never did switch to the new .on() method that they added a while back and the application does do some sniffing using the $.browser object. So, I guess that means I won't be able to upgrade to the 1.9 release.


Mike: Ohh, no! The jQuery team planning for issues like this so they went ahead and put all of the removed deprecated features into a migration plugin in case you still need it. That way you can use the new stuff without having to immediately refactor your existing code. The idea is that you can slowly refactor as needed.Frank: Really!?! Wow, that is so easy. Let me guess, that was explained in the release notes too? Mike: Yep ;) No probably man, it happens. Now don't get me wrong there are some releases where some bugs are introduced in a major release, but they are usually found pretty quickly and a minor release comes out shortly after. However, with this particular issue there was a planned workaround.Frank: Why looky there, I just applied the migration plugin and now my app is working as expected. Thanks for your help Mike.Mike: I didn't really do anything, it was the jQuery core members... you should thank them ;)

Edit post on GitHub

Beginner HTML5, JavaScript, jQuery, Backbone, and CSS3 Resources
The Magic of the jQuery 1.9 Source Map