thomaswilburn/Caret — pull request #83 by fuzetsu (2013-12-11 02:27:13+00:00)
Title: Only reorder when there is a target fixes #81

Fixes disappearing tabs, previously the tab was being removed from the
tab array and disappearing from the UI when sorted, since the `from` and
`onto` were the same (itself).

The `drop` event triggered the sorting to handle any changes in tab position, when dragging a tab to the far right the target chosen ends up being the closest tab to it (in this case the same tab that was dropped) and so the `from` and `onto` elements all end being the same. Because of the conditions in the reordering loop the tab never got pushed back into the new array and so was left behind, still present in the `stack` but not in the `tabs`.