Sort DOM elements