derickbailey/backbone.picky — pull request #29 by hashchange (2014-01-27 09:00:09+00:00)
Title: Changed event parameters to always include collection; "diff" hash for MultiSelect

This PR provides additional info to event handlers.

_SingleSelect events_ now pass the collection as the second parameter. The collection info is required by event handlers listening to more than one collection.

(That's a side effect of multi-collection support, #16 / #23. `model.collection` used to be enough, but it just gives access to the first collection a model is assigned to.)

_MultiSelect `select:*` events_ provide a "diff" hash, `{selected: [...], deselected: [...]}`, as the second parameter. The collection is now passed as the third parameter (used to be second).

The MultiSelect change could have been backward compatible by providing the diff as third parameter, keeping the collection second. But then the API would have been inconsistent with SingleSelect (arg pattern: modification (model), context (collection), options). I reckon the break in compatibility is not a big deal, though, the args hadn't even been documented so far.

Based on my previous commits. Tests are adjusted, documentation updated.