Major Updates To jQuery
John Resig and the jQuery team have been busy releasing jQuery 1.2 and a bugfix version 1.2.1.
jQuery Version 1.2
The jQuery team tries to keep the library as small as possible. Unfortunately that means some things have been deprecated or moved into plugins.
A backwards compatibility plugin is available to assist or delay any changes needed to use the new version.
Several XPath selector features were removed, including Descendant (ex. $(“div//p”) ), Child (ex. $(“div/p”) ), Parent (ex. $(“p/../div”) ), Contains Predicate (ex. $(“div[p]“) ), and Attribute (ex. $(“a[@href]“) ). It is recommended that instead of these selectors, the corresponding CSS or other selectors be used. Or use the XPath Compatibility Plugin.
The parametized clone() method (ex. $(“div”).clone(false) ) has been deprecated. .clone() is still supported, but instead of using the false argument, use .clone().empty() instead.
DOM Traversal methods .eq(), .lt(), .gt(), and .contains() have been deprecated in favor of using .slice() and .filter(). Note that 1.2.1 brings back .eq().
The Ajax methods .loadIfModifed() and .getIfModifed() are deprecated. You should use the $.ajax() method with the “ifModified:true” option instead. Also, $.ajaxTimeout is now deprecated in favor of $.ajaxSetup(). .evalScripts() has been removed as it is no longer necessary; all scripts in HTML strings are automatically evaluated when injected into the document.
Now for the good stuff.
Besides the new XPath Compatibility Plugin mentioned above, the core now supports :has(selector), :header, and :animated.
New DOM traversal methods include .map(), .prevAll() and .nextAll(), .slice(), .hasClass(), .andSelf(), and .contents().
New DOM manipulation methods include .wrapInner() and .wrapAll(), .replaceWith() and .replaceAll(), and .clone(true) Event Cloning.
New .offset(), .height() and .width() CSS methods were added.
Ajax support was improved with support for partial .load(), Cross-Domain getScript(), JSONP, and disabling caching. Also .serialize() has been reworked.
New effects features support .stop(), % and em animations, color animations, relative animations, queue control, the :animated selector, and custom animation types with the step Function.
Namespaced Events and .triggerHandler() are also new.
jQuery now has its own UI, including draggables, droppables, resizables, shadows, sliders, sortables, tabs, accordians, selectables, trees, and modals.
Well, it has a few bugs, but it really is nice. And, of course, they’re hard at work squashing the bugs as fast as possible.
jQuery Version 1.2.1
A bugfix release on September 16th fixes some bugs and adjusts the API in two places.
Due to overwhelming demand, .eq() has returned in version 1.2.1. Also, a problem with the relative animation API has been fixed.
This is a major step forward for jQuery. The loss of XPath and a few features in the core is a slightly bitter pill, but plugins help with this. The additional features are great, and the new UI library is welcome.