n-time/backbone.validations — pull request #34 by spmason (2013-01-24 14:46:13+00:00)
Title: Updated Backbone.Validations to work with Backbone 0.9.10

Backbone 0.9.10 has some fairly big changes to validation, though the changes to Backbone.Validations are confined to the `newPerformValidation` function

I've just made it re-use the default `Backbone._validate` function instead of re-implementing it, to save some hassle. Some extra work is required to raise `invalid:prop` events, you wouldn't have to override `_validate` at all if it didn't have to raise these..

For reference, the new behaviour is as follows:

- `invalid` events are now raised for validation errors as `error` is now reserved for xhr errors (this is badly documented but the correct behaviour: https://github.com/documentcloud/backbone/issues/2153)
- To get validation to fire on `set`, call with {validate: true} (I had to update the unit tests)
- The `error` callback is not called on validation errors, you can inspect the `model.validationError` property instead, immediately after calling `save`