parent
h5

h3 class "third"

span span also class "second" span class "second"

p

p class "first"

p

h3

h2

span

p

In this example, we return all elements with class names "first", "second" and "third", that are previous siblings between h2 and h5.