You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
prevAll(), closest() and other traversals don't return results in jQuery's order #117
jQuery returns the results of its reverse-direction traversals in reverse document order, de-duplicated (.parents(), .parentsUntil(), .prevAll(), .prevUntil()), and runs uniqueSort on the others. #72 brought parents() and parentsUntil() in line, but the rest still return results grouped by starting element, in walk order:
$xml = '<r><a/><b/><c/><d/></r>';
qp($xml, 'c, d')->prevAll();
// QueryPath: b, a, c, b, a → after de-dup: b, a, c (grouped per start node)// jQuery: c, b, a (reverse document order)
This matters beyond presentation: since #70, positional selectors (:first, :eq(n), …) count within the set, so prevAll(':first') picks a different element depending on the method's ordering. The CHANGELOG's "position within the set" guarantee currently holds only for some methods.
Affected
prevAll(), prevUntil(), closest(), parent(), siblings(), next()/prev() on multi-element sets. Each needs checking against jQuery 3.x.
Proposal
Decide the order per method from jQuery's source, and apply it in one place (ideally the shared traversal helper from the consolidation issue) rather than per method. This is a behaviour change and should be marked as one in the CHANGELOG.
Activity
Return traversal results in jQuery's order
Return traversal results in jQuery's order