mikeric/rivets — pull request #275 by ydaniv (2014-02-14 10:37:45+00:00)
Title: Make each-* routine compatible with collections

Current implementation overwrites objects in-place, so when another object (e.g. a UI component) references the object in the collection that's overwritten discrepancies start to appear between the state of that component and the object (model) in the collection it's referencing.

This implementation maintains the original objects while keeping the correct state and same index order of collection and DOM elements.

This means that the each-* routine can now be safely used with Backbone.js/Spine.js/etc collections and therefore, Rivets.js can become a genuine part of any SPA stack.

This implementation has been tested in a stack using Backbone.js and supports listening to the `add`, `remove` and `sort` events of Backbone's collections, with UI components referencing both the collection and each of its models.

~Y