emberjs/ember.js — pull request #1482 by crofty (2012-10-22 14:54:56+00:00)
Title: Fix bug in SortableMixin when changing item position

This fixes a bug in the SortableMixin where the sort was being done incorrectly when the observed properties changed.

The reason for the bug was that the new index for an item was being determined by doing a binary search across an array that already included the item. In order to determine the correct position, the binary search needs to be done across an array that doesn't already include the item.

I've changed the arguments that `_binarySearch` takes, it shouldn't be a big deal because this is part of the private API. It now takes an array that it will do the search over as the first argument. I've also specified defaults for the low and high arguments so that these can be left off in the most common use case for `_binarySearch`