jQuery 1.4 Released
Last week, version 1.4 of the popular jQuery library was released. The new version includes some big performance gains, alongside other cool stuff like:
- The ability to use .attr -style setter functions for all setters.
- Rails-style nested-parameter serialization for Ajax calls.
- Quick Element Construction: You can now pass in an object to add attributes and events at element-creation time:
jQuery("<div/>", { id: "foo", css: { height: "50px", width: "50px", color: "blue", backgroundColor: "#ccc" }, click: function() { $(this).css("backgroundColor", "red"); } }).appendTo("body");
- Per-property Easing: You can now specify easing for individual properties of an effect.
- The new jQuery.proxy method allows you to bind
thisinside an event-handler to a specific object. - You can now bind many events to an element by passing an object containing those events:
$("div.test").bind({ click: function(){ $(this).addClass("active"); }, mouseenter: function(){ $(this).addClass("inside"); }, mouseleave: function(){ $(this).removeClass("inside"); } });
- All events can now be .live events.
- Some new DOM-traversal, manipulation and utility functions have been introduced.
The 14 Days of jQuery website, created to celebrate the new release, covers what’s new in more detail.