The jQuery Cookbook (2010 O"Reilly) is great, but with the rapid advance of the jQuery API it is already becoming outdated. The cookbook covers jquery 1.3.2 and as of the time of this writing, the current API version is 1.6.2. Similarly, the version of jQuery that ships with Drupal 7 is just 1.4.4.
Newer versions of jQuery offer improved performance and should be used on fresh projects. Version 1.5 has the main addition of deferred callback management. It is important to stay up to date with the new features of jQuery. Here is a list of all new API methods:
| method | version | category | synopsis |
|---|---|---|---|
| .clearQueue() | 1.4.0 | Custom, Data, Utilities | Remove from the queue all items that have not yet been run. |
| jQuery.contains() | 1.4.0 | Utilities | Check to see if a DOM element is within another DOM element. |
| .delay() | 1.4.0 | Custom | Set a timer to delay execution of subsequent items in the queue. |
| .detach() | 1.4.0 | DOM Removal | Remove the set of matched elements from the DOM. |
| .first() | 1.4.0 | Filtering | Reduce the set of matched elements to the first in the set. |
| .focusin() | 1.4.0 | Keyboard Events, Mouse Events | Bind an event handler to the "focusin" JavaScript event. |
| .focusout() | 1.4.0 | Keyboard Events, Mouse Events | Bind an event handler to the "focusout" JavaScript event. |
| .has() | 1.4.0 | Filtering | Reduce the set of matched elements to those that have a descendant that matches the selector or DOM element. |
| jQuery.isEmptyObject() | 1.4.0 | Utilities | Check to see if an object is empty (contains no properties). |
| jQuery.isPlainObject() | 1.4.0 | Utilities | Check to see if an object is a plain object (created using "{}" or "new Object"). |
| .last() | 1.4.0 | Filtering | Reduce the set of matched elements to the final one in the set. |
| .nextUntil() | 1.4.0 | Tree Traversal | Get all following siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object passed. |
| jQuery.noop() | 1.4.0 | Utilities | An empty function. |
| .parentsUntil() | 1.4.0 | Tree Traversal | Get the ancestors of each element in the current set of matched elements, up to but not including the element matched by the selector, DOM node, or jQuery object. |
| .prevUntil() | 1.4.0 | Tree Traversal | Get all preceding siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object. |
| jQuery.proxy() | 1.4.0 | Event Handler Attachment, Utilities | Takes a function and returns a new one that will always have a particular context. |
| .toArray() | 1.4.0 | DOM Element Methods | Retrieve all the DOM elements contained in the jQuery set, as an array. |
| .unwrap() | 1.4.0 | DOM Insertion, Around, DOM Removal | Remove the parents of the set of matched elements from the DOM, leaving the matched elements in their place. |
| jQuery.error | 1.4.1 | Internals | Takes a string and throws an exception containing it. |
| .delegate() | 1.4.2 | Event Handler Attachment | Attach a handler to one or more events for all elements that match the selector, now or in the future, based on a specific set of root elements. |
| .undelegate() | 1.4.2 | Event Handler Attachment | Remove a handler from the event for all elements which match the current selector, now or in the future, based upon a specific set of root elements. |
| jQuery.cssHooks | 1.4.3 | CSS | Hook directly into jQuery to override how particular CSS properties are retrieved or set, normalize CSS property naming, or create custom properties. |
| event.namespace | 1.4.3 | Event Object | The namespace specified when the event was triggered. |
| jQuery.fx.interval | 1.4.3 | Custom, Properties of the Global jQuery Object | The rate (in milliseconds) at which animations fire. |
| jQuery.isWindow() | 1.4.3 | Utilities | Determine whether the argument is a window. |
| jQuery.now() | 1.4.3 | Utilities | Return a number representing the current time. |
| jQuery.type() | 1.4.3 | Utilities | Determine the internal JavaScript [[Class]] of an object. |
| .fadeToggle() | 1.4.4 | Effects, Fading | Display or hide the matched elements by animating their opacity. |
| jQuery.ajaxPrefilter() | 1.5.0 | Low-Level Interface | Handle custom Ajax options or modify existing options before each request is sent and before they are processed by $.ajax(). |
| deferred.done() | 1.5.0 | Deferred Object | Add handlers to be called when the Deferred object is resolved. |
| deferred.fail() | 1.5.0 | Deferred Object | Add handlers to be called when the Deferred object is rejected. |
| deferred.isRejected() | 1.5.0 | Deferred Object | Determine whether a Deferred object has been rejected. |
| deferred.isResolved() | 1.5.0 | Deferred Object | Determine whether a Deferred object has been resolved. |
| deferred.promise() | 1.5.0 | Deferred Object | Return a Deferred"s Promise object. |
| deferred.reject() | 1.5.0 | Deferred Object | Reject a Deferred object and call any failCallbacks with the given args. |
| deferred.rejectWith() | 1.5.0 | Deferred Object | Reject a Deferred object and call any failCallbacks with the given context and args. |
| deferred.resolve() | 1.5.0 | Deferred Object | Resolve a Deferred object and call any doneCallbacks with the given args. |
| deferred.resolveWith() | 1.5.0 | Deferred Object | Resolve a Deferred object and call any doneCallbacks with the given context and args. |
| deferred.then() | 1.5.0 | Deferred Object | Add handlers to be called when the Deferred object is resolved or rejected. |
| jQuery.hasData() | 1.5.0 | Data | Determine whether an element has any jQuery data associated with it. |
| jQuery.parseXML() | 1.5.0 | Utilities | Parses a string into an XML document. |
| jQuery.sub() | 1.5.0 | Core | Creates a new copy of jQuery whose properties and methods can be modified without affecting the original jQuery object. |
| jQuery.when() | 1.5.0 | Core | Provides a way to execute callback functions based on one or more objects, usually Deferred objects that represent asynchronous events. |
| deferred.always() | 1.6.0 | Deferred Object | Add handlers to be called when the Deferred object is either resolved or rejected. |
| deferred.pipe() | 1.6.0 | Deferred Object | Utility method to filter and/or chain Deferreds. |
| :focus selector | 1.6.0 | Basic Filter, Form | Selects element if it is currently focused. |
| jQuery.holdReady() | 1.6.0 | Core | Holds or releases the execution of jQuery"s ready event. |
| .promise() | 1.6.0 | Deferred Object | Return a Promise object to observe when all actions of a certain type bound to the collection, queued or not, have finished. |
| .prop() | 1.6.0 | Attributes, General Attributes | Get the value of a property for the first element in the set of matched elements. |
| .removeProp() | 1.6.0 | Attributes, General Attributes | Remove a property for the set of matched elements. |
Knowing the new methods is great, but seeing examples of them in action is even better. We will do exactly this in the next post.
Type:
jQuery

All Articles
Comments
Mthx ugg boots store gives you some suggestions 5045
Add new comment