Is order of elements returned from query supposed to match order of elements in document in 1.3.2 version of jQuery. I am doing following select from unordered list.
$el.parents('li')
and it is returning it in reversed order, from bottom up.
$el is three levels deep “li”.
I understand that it walks the tree up, but this http://docs.jquery.com/Release:jQuery_1.3.2 explicitly states that elements are returned in the order they appear in document. So is this a bug?
Parentstraverses the DOM from the nearest parent to the outermost, which is why it is returned in “reverse”. Jquery does not reorder its results ordinarily — if the method of traversal is top to bottom, the results are returned “in order” (top to bottom). If the method of traversal is inner to outer then the results are returned “out of order”.