Jquery: get ancestors (or descendants) and self
- by gsakkis
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() ?