Say i have an array of 10 elements, that some of them are actually children of some of the other elements. How would i go about ordering this array so to top parents are first in order, and the deepest children are last?
[
input,
select,
radio,
div (containing some of the form elements in the array),
h2,
div (containing the h2 in the array),
form,
textarea,
a,
span
]
In this particular case, the form element might be the toppest parent, but the solution I'm looking for is to create such an order without any such knowledge