From f537de24bef4f7e1e6695589c204f504cecf05c1 Mon Sep 17 00:00:00 2001 From: Leonardo Balter Date: Wed, 22 Jan 2014 09:44:05 -0200 Subject: [PATCH] .find(): treat as not unique to require a selector argument Fixes: #395 --- entries/find.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entries/find.xml b/entries/find.xml index 8ce3d0fc..96172841 100644 --- a/entries/find.xml +++ b/entries/find.xml @@ -49,7 +49,7 @@ $( "li.item-ii" ).find( "li" ).css( "background-color", "red" );

The result of this call is a red background on items A, B, 1, 2, 3, and C. Even though item II matches the selector expression, it is not included in the results; only descendants are considered candidates for the match.

-

Unlike in the rest of the tree traversal methods, the selector expression is required in a call to .find(). If we need to retrieve all of the descendant elements, we can pass in the universal selector '*' to accomplish this.

+

Unlike in the most of the tree traversal methods, the selector expression is required in a call to .find(). If we need to retrieve all of the descendant elements, we can pass in the universal selector '*' to accomplish this.

Selector context is implemented with the .find() method; therefore, $( "li.item-ii" ).find( "li" ) is equivalent to $( "li", "li.item-ii" ).

As of jQuery 1.6, we can also filter the selection with a given jQuery collection or element. With the same nested list as above, if we start with: