As said, we just follow the specification, so this is the expected behavior.
In your case, this is what you could do:
var elements = $$('elements');
elements.sort(function(a, b){
if (a.id == b.id) return 0;
return (a.id > b.id) ? 1 : -1;
});
That is all.
