ancestors

Returns a sequence of all ancestors of this element, starting with the element itself.

If you want to exclude the element itself from the sequence, simply call drop(1) on the returned sequence.