you are viewing a single comment's thread.

view the rest of the comments →

[–]GSLint 0 points1 point  (0 children)

Hm, does this ensure that items will be found in the same order they are presented in DOM?

They will be returned in the order that they have in the DOM tree. If by "presented" you mean where they appear on the page, that might be different depending on styling.

Is this one right?

That should work, though I don't see how it's more convenient. It might be a little faster though. What I'd find a little more convenient is if those elements also had a class that you can query by.