Tag Archives: 1.9 Upgrade

Updating to jQuery 1.9

Background on why I was Updating to jQuery 1.9:  For a number of reasons, I needed to update my website to a newer version of jQuery, jQuery 1.9. My site, designed in 2010 was started on v1.4 and had last been updated to 1.7 in 2011. I knew I had several out-of-date methods and expected to some debugging and troubleshooting. Well, in the end, it took me 6 hours spread over two days. It wasn’t really that bad, but since I don’t upgrade jQuery everyday, I had a little re-learning to go through.

For starters, I knew that v1.9 had deprecated many of its old methods. In fact, I learned from the upgrade web page, , that v1.9 comes with a special migration plug-in. I was pleased to see this and used this to address most all of my updating challenages.

For example, $.browser() method was deprecated. The migrate script reported this to me in the Chrome console, as follows:

Chrome console:

With a little digging, I was able to find that I was using an old version of blockUI. When I changed to the new version the warning message went away.

I also got the following warning messages related to type changing and the change to the andSelf() method:

Chrome console:

Again, it took a lot of digging, but I was able to isolate the problem to my tmpl.js script. I was using a really old version. I think with a little more skill on my part, I would better be able to use stack backtraces or some other Chrome tool to find these quicker, but this problem was hard for me to find.

Since I was also using an old version of jQuery-UI, I stumbled upon a couple of breakages triggered by curCSS:

Chrome console:

For some reason, also, the dialog() method wouldn’t display text in the “OK” button and it would always popup at 0.0 (upper left), so I upgraded to jQuery-ui v1.9.2.

One last thing for Updating to jQuery 1.9. I had to change all of my .live() events to .on(). The migration guide clearly covered this.

Here’s an example from my website:

//$('#journal input').live('keydown', function(evt) {
$(document).on('keydown','#journal input', function(evt) {

This was easy to do; I had to do it in 6 different place, and it worked the first time.

Updating to jQuery 1.9 was a little more painful than I would like, but feels good to get caught up.

Ok, now that I’ve converted to jQuery v1.9, I can try out some of the new things.