jQuery Version 1.4 Has Been Released

jQuery I don’t know about you, but I have begun using jQuery pretty extensively in my UI development.  I know not everyone can, and if you’re in that crowd, I am sooo sorry! :)  jQuery has quite simply and almost single-handedly had an extremely positive impact on all of my web UI.  Through some cool tricks that I’ve picked up here and there, I have created some of the coolest UI’s that I have ever done.  Anyhow, that experience is sure to prove to only get better, as I noticed today that a new version of jQuery is finally upon us!

Introducing jQuery Version 1.04!

I have been running with and using version 1.03.02 for a while now, and it’s been very stable for me.  However, I was surprised to see that one of the things done in version 1.04 was that they fixed over 200 bugs!  Holy crap!  I am sure glad I haven’t run into any of those.  jQuery has been around for 4 years now.  And in this latest version, they’ve increased the speed of many of the common functions that we use, sometimes by 75%!

You can find and download jQuery in it’s normal places:

You can find all of the good stuff about this update on their 14 Days of jQuery website.  What I will do though, is highlight some of the things that you’ll want to look out for after upgrading your own jQuery file references on your site.

jQuery.ready()

I have been using the long form of the ready statement ever since starting out with jQuery.  I’ve done it on purpose, just for the reason I am about to tell you about.  I didn’t want to have to go back into my code and fix any short-cuts I might have made in the past.  With version 1.04, you have to make the following changes in your code:

   1:  // no worky anymore
   2:  jQuery().ready( function() {
   3:     // your code
   4:  } );
   5:   
   6:  // gotta do this now
   7:  jQuery(document).ready( function() {
   8:     // your code
   9:  } );

(Of course, you can still use the $ shortcut. I just choose not to, in order to have cleaner, more consistent code throughout.)

Selector Speed

Using IDs for your selector, or at least the first selector will make your code run much faster than if you do not.

   1:  // slower
   2:  var divWrapper = jQuery('.wrapper');
   3:  var pDesc = jQuery('.wrapper p#description');
   4:   
   5:  // MUCH faster
   6:  var divWrapper = jQuery('#divWrapper');
   7:  var pDesc = jQuery('#description');

“Traditional” AJAX

The AJAX functions have been improved to allow for nested parameter serialization.  However, this may cause problems with single parameter requests.  In these instances, use one of the following methods to enable the “traditional” AJAX serialization that you’re already used to in v1.03.02.

   1:  // Enables for all serialization
   2:  jQuery.ajaxSettings.traditional = true;
   3:   
   4:  // Enables for a single serialization
   5:  jQuery.param( stuff, true );
   6:   
   7:  // Enables for a single Ajax requeset
   8:  $.ajax({ data: stuff, traditional: true });

contentType with AJAX Requests

Previously, if you didn’t specify any data in an AJAX request, jQuery simply didn’t pass contentType along.  This has been a huge pain for many ASP.Net developers (including myself).  Now, the contentType is always sent, regardless of whether the data parameter is filled or not.

Summary

For a full list of backwards compatibility concerns, please see this URL:  http://jquery14.com/day-01/jquery-14#backwards

In summary, it would not be an issue for most sites to upgrade.  However, if you’re using any 3rd party plug-ins, you will first want to make sure that those plug-ins will still work.  So, I’d suggest an offline or staging test of the upgraded script first.  However, if for nothing else, you really should upgrade for the speed benefits in version 1.04.  What’s really cool is that if you want the speed, but also want to be backwards compatible, the jQuery team has though about you!

You can be backwards compatible by including the backwards compatibility plug-in on your site.  Here’s an example from their site:

   1:  <script src="http://code.jquery.com/jquery.js"></script>
   2:  <script src="http://code.jquery.com/jquery.compat-1.3.js"></script>

I haven’t tried upgrading any of my DotNetNuke® sites yet, but you have better bet I will very soon!  :)

Technorati Tags: ,


blog comments powered by Disqus

© Copyright 2004-2013 by Will Strohl. All rights reserved. Website Skinned By: Ralph Williams  Website Hosted By: Applied Innovations