I use jQuery a lot, especially the
find method which is why this little quirk threw me. I've thought of
find to be an extension to a selector string. It allows some use of arbitrary methods after the selector string and then continues to find even more. But using it with a finite selector (:first, :last, :eq, etc) causes it to search within each element. This isn't a problem for classes or elements within the selection, as find will return any number of those. But using it to retrieve the first element in the set, causes it to return the first element in each currently selected element.
The first line retrieves the last list item,
Blue. The second line retrieves the last list item in
each ordered list, as does the third line. The fourth line is what is necessary to match the same element as the selector string in line one, albeit with a gap for the aforementioned extra methods. Is there a simpler way of achieving this?
I know the current functionality of
find has been like this since 1.6 at least, so it might just break something if it changed. But I would prefer it if the
each method would act as
find does currently, and then
find would act as a continuation of the selector string.
Thanks.