I’m looking for a way to find which of two objects is the closest relation to a third object in terms of the DOM Tree order, not the pixels.
The two objects requiring comparison could appear anywhere on the DOM, relative to the object I wish to compare them with.
Assuming that object is Node then you can always use
Absolute position
dom tree position
Using
iterativelyWalk