How is the selection array sorted?
Hi all,
I am trying to change the positions of selected text frames through JavaScript.
Using app.activeDocument.selection I am able to retrieve the array of selected items.
For example, in this selection:

app.activeDocument.selection[0] returns the text frame containing "Top Title"
app.activeDocument.selection[1] returns the text frame containing "Bottom Caption"
app.activeDocument.selection[2] returns the text frame containing "1"
app.activeDocument.selection[3] returns the text frame containing "D"
However, I can't reliably determine which index of the array gives me a particular text frame.
How is this order determined? If it is random, how would I be able dynamically differentiate each text frame?