Opened 14 years ago
Closed 14 years ago
#4391 closed bug (invalid)
:has() selector is inconsistent when used with element created by .after()
Reported by: | beaugunderson | Owned by: | john |
---|---|---|---|
Priority: | major | Milestone: | 1.4 |
Component: | selector | Version: | 1.3.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Attached is a reproduction that shows the problem in Chrome, IE7, and FF 3.1b3 in my testing.
The reproduction involves adding a list item containing an anchor to the page and then using .next("has:(a)") from a previous sibling to select that element.
It seems to work when .next() is used on the same node that .after() was, but not in the case where .next() is used several siblings before the node that .after() was used on. In that case, the element is not selected.
If this is expected behavior when using .after() to add nodes to the page then I think this is still a valid bug, but in that case only a documentation bug. :)
Attachments (1)
Change History (2)
Changed 14 years ago by
Attachment: | Has Selector Test.html added |
---|
comment:1 Changed 14 years ago by
Resolution: | → invalid |
---|---|
Status: | new → closed |
The docs seem pretty clear to me already:
next only returns the very next sibling for each element, not all next siblings (see nextAll). You may provide an optional expression to filter the returned set.
http://docs.jquery.com/Traversing/next#expr
As the docs say, the optional expression is only filtering the result set. I am thinking you were expecting it to search for the next sibling element that matched the expression you provided, but that's not what it's documented to do.
Bug repreoduction