The 5 Emotional Stages of a jQuery Upgrade
22 Jan 2013The 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.
Sadness
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.
Fear
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.
Anger
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.
Shame
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.
Gladness
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 ;)