private function sortHelper(a:Element, b:Element):int { if (a.foo < b.foo) return -1; else return int(a.foo != b.foo); }