All jQuery selectors return an array of objects. Are these objects always in the same order as they are in the HTML? Can I rely on this?
There may be some exceptions, for example from the prevAll() documentation:
"Given a jQuery object that represents a set of DOM elements, the .prevAll() method searches through the predecessors of these elements in the DOM tree and construct a new jQuery object from the matching elements; the elements are returned in order beginning with the closest sibling."
http://api.jquery.com/prevAll/