Bug Tracker

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:


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)

Has Selector Test.html (1.0 KB) - added by beaugunderson 14 years ago.
Bug repreoduction

Download all attachments as: .zip

Change History (2)

Changed 14 years ago by beaugunderson

Attachment: Has Selector Test.html added

Bug repreoduction

comment:1 Changed 14 years ago by dmethvin

Resolution: invalid
Status: newclosed

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.


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.

Note: See TracTickets for help on using tickets.