From a782afdfd00f12cc6fab25c83bbaeefd0705b544 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=B6rn=20Zaefferer?= Date: Tue, 27 Feb 2007 21:32:28 +0000 Subject: [PATCH] Backported wiki changes from http://docs.jquery.com/API/1.1.1/DOM/Traversing --- src/jquery/jquery.js | 62 ++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 50 insertions(+), 12 deletions(-) diff --git a/src/jquery/jquery.js b/src/jquery/jquery.js index 1d96eac..cd4d4e7 100644 --- a/src/jquery/jquery.js +++ b/src/jquery/jquery.js @@ -768,12 +768,37 @@ jQuery.fn = jQuery.prototype = { }, /** - * End the most recent 'destructive' operation, reverting the list of matched elements - * back to its previous state. After an end operation, the list of matched elements will - * revert to the last state of matched elements. + * Revert the most recent 'destructive' operation, changing the set of matched elements + * to its previous state (right before the destructive operation). * * If there was no destructive operation before, an empty set is returned. * + * A 'destructive' operation is any operation that changes the set of + * matched jQuery elements. These functions are: + * These functions are: + * + * add + * + * children + * + * clone + * + * filter + * + * find + * + * not + * + * next + * + * parent + * + * parents + * + * prev + * + * siblings + * * @example $("p").find("span").end(); * @before

Hello, how are you?

* @result [

...

] @@ -924,6 +949,13 @@ jQuery.fn = jQuery.prototype = { * of matched elements. This method is used to remove one or more * elements from a jQuery object. * + * Please note: the expression cannot use a reference to the + * element name. See the two examples below. + * + * This will not work: $(".res img").not("img[@src$=on]") + * + * This will: $(".res img").not("[@src$=on]"); // also could be written $(".res img:not([@src$=on])") + * * @example $("p").not( $("div p.selected") ) * @before

Hello

Hello Again

* @result [

Hello

] @@ -952,8 +984,12 @@ jQuery.fn = jQuery.prototype = { * to the set of matched elements. * * @example $("p").add("span") - * @before

Hello

Hello Again - * @result [

Hello

, Hello Again ] + * @before (HTML)

Hello

Hello Again + * @result (jQuery object matching 2 elements) [

Hello

, Hello Again ] + * @desc Compare the above result to the result of $('p'), + * which would just result in [

Hello

]
. + * Using add(), matched elements of $('span') are simply + * added to the returned jQuery-object. * * @name add * @type jQuery @@ -1783,7 +1819,7 @@ new function() { * Get a set of elements containing the unique parents of the matched * set of elements. * - * Can be filtered with an optional expressions. + * You may use an optional expression to filter the set of parent elements that will match. * * @example $("p").parent() * @before

Hello

Hello

@@ -1805,7 +1841,7 @@ new function() { * Get a set of elements containing the unique ancestors of the matched * set of elements (except for the root element). * - * Can be filtered with an optional expressions. + * The matched elements can be filtered with an optional expression. * * @example $("span").parents() * @before

Hello

Hello Again
@@ -1827,9 +1863,10 @@ new function() { * Get a set of elements containing the unique next siblings of each of the * matched set of elements. * - * It only returns the very next sibling, not all next siblings. + * It only returns the very next sibling for each element, not all + * next siblings. * - * Can be filtered with an optional expressions. + * You may provide an optional expression to filter the match. * * @example $("p").next() * @before

Hello

Hello Again

And Again
@@ -1851,9 +1888,9 @@ new function() { * Get a set of elements containing the unique previous siblings of each of the * matched set of elements. * - * Can be filtered with an optional expressions. + * Use an optional expression to filter the matched set. * - * It only returns the immediately previous sibling, not all previous siblings. + * Only the immediately previous sibling is returned, not all previous siblings. * * @example $("p").prev() * @before

Hello

Hello Again

And Again

@@ -1897,7 +1934,8 @@ new function() { * Get a set of elements containing all of the unique children of each of the * matched set of elements. * - * Can be filtered with an optional expressions. + * This set can be filtered with an optional expression that will cause + * only elements matching the selector to be collected. * * @example $("div").children() * @before

Hello

Hello Again

And Again

-- 1.7.10.4