What's new in jQuery 1.6

Well, jQuery 1.6 is now live and available for consumption! You can get the code from the jQuery CDN:

http://code.jquery.com/jquery-1.6.js
http://code.jquery.com/jquery-1.6.min.js

You can also get the code from other CDNs as well:
Microsoft: http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.6.min.js
(Google is still uploading their copy.)
Along with some bug fixes, some new features are introduces in this release. These are

Case-mapping of data- attributes
jQuery 1.5 introduced a feature in the .data() method to automatically import any data- attributes that were set on the element and convert them to JavaScript values using JSON semantics. In jQuery 1.6 they have updated this feature to match the W3C HTML5 spec with regards to camel-casing data attributes that have embedded dashes. So for example in jQuery 1.5.2, an attribute of data-max-value="15" would create a data object of { max-value: 15 } but as of jQuery 1.6 it sets { maxValue: 15 }.

.prop(), .removeProp(), and .attr()
In the 1.6 release they’ve split apart the handling of DOM attributes and DOM properties into separate methods. The new .prop() method sets or gets properties on DOM elements, and .removeProp() removes properties. In the past, jQuery has not drawn a clear line between properties and attributes. Generally, DOM attributes represent the state of DOM information as retrieved from the document, such as the value attribute in the markup <input type="text" value="abc" />. DOM properties represent the dynamic state of the document; for example if the user clicks in the input element above and types def the .prop("value") is abcdef but the .attr("value") remains abc.

Boolean Attributes
In jQuery 1.6 Boolean attributes (such as selected, checked, etc.) can now be toggled by passing in true or false to .attr() to either add or remove them. For example:
$("#checkbox").attr("checked", true); // Checks it
$("#checkbox").attr("checked", false); // Unchecks it

jQuery.holdReady()
jQuery provides a mechanism for delaying the execution of the ready event (primarily for plugin authors). The API for this mechanism has been improved in 1.6, resulting in a single, simple, method:
jQuery.holdReady( true ); // Pause execution of ready event
// later...
jQuery.holdReady( false ); // Resume execution

:focus Selector
In jQuery 1.6, it is ensured that the :focus selector works properly across all browsers. You can use this selector to find the currently focused element on the page (such as a form input).
$("input:focus").addClass("active");
You can find the complete list of jQuery 1.6 API changes
http://api.jquery.com/category/version/1.6/

Feel free to contact me for any help related to jQuery, I will gladly help you.
SHARE

Nothing shocks me, I'm a Software Engineer. And I am not young enough to know everything. I live in World Wide Web and from there take care of this website. This website communicates about my work, learning and experience. I believe life is short, and it is for loving, sharing, learning and connecting. So lets connect..