Update fix JQuery 1.6.1

As you may well know, at the beginning of this month, JQuery 1.6 was released, in version 1.6 the Attribute module was rewritten and a new method named .prop() emerged. Because .prop() took over the boolean attributes/properties, code previously made for version 1.5.1 stopped working.

The 1.6.1 release does the wright thing and made possible for the old code to work without any changes, what it does is deferring the call from .attr() to .prop() when needed. Thank you JQuery Team!

.attr() vs .prop()

Because .att() still works the same way as in 1.5.1 that doesn’t mean that you have to use it wrong, as of JQuery 1.6 you should use .attr() or .prop() in these cases:

.attr() .prop()
accesskey async
align autofocus
class checked
contenteditable defaultValue
draggable disabled
href location
id multiple
label nodeName
rel nodeType
src readOnly
style selected
tabindex selectedIndex
title tagName
type
width
Reason to update

What got me convinced that I need to update all my projects to version 1.6 was this graph posted on JQuery blog, it shows the improved performance of event triggering with .data() method.

jQuery 1.6 .data() (get and set) graph

A full list of performance improvements and bug fixes can be found in this post.

Update to 1.6.1 with NuGet

In order to update your MVC 3 projects to the latest JQuery version, in Visual Studio Solution Explorer right click your project and select from the menu “Add Library Package Reference…”, on the pop-up select “Updates” and click on the package. Or from VS.NET NuGet command line run PM> Install-Package jQuery.

Tags: