The below code is a simple Javascript function that allows to input an element [sourceElement] and recursively travel up the parent tree storing all of the parents in array and returning the array.
Example use:
The array of parent elements return can be manipulated and have properties returned just like any other html element in JavaScript.