Jquery: get ancestors (or descendants) and self

Posted by gsakkis on Stack Overflow See other posts from Stack Overflow or by gsakkis
Published on 2010-03-24T14:31:44Z Indexed on 2010/03/24 14:33 UTC
Read the original article Hit count: 212

Filed under:
|
|
|

One can use matchedset.find(selector) / matchedset.parents(selector) to get the descendants/ancestors of the current matched set filtered by a sealector, but that doesn't include the matched set itself (if it happens to match the selector too). Is there a better (more consise and/or faster) way to get it than

matchedset.find(selector).add(matchedset.filter(selector))

and the respective for parents() ?

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about filter