Backbone.validateAll.js | |
---|---|
Locally passes in the | (function (window, document, undefined) {
|
Checks to make sure Backbone, Backbone.Model and the private validate method are on the page |
if(window.Backbone && window.Backbone.Model && window.Backbone.Model.prototype._validate) {
|
Run validation against the next complete set of model attributes,
returning |
window.Backbone.Model.prototype._validate = function(attrs, options) {
if (options.silent || !this.validate) return true;
if (options.validateAll !== false) attrs = _.extend({}, this.attributes, attrs);
var error = this.validate(attrs, options);
if (!error) return true;
if (options && options.error) {
options.error(this, error, options);
} else {
this.trigger('error', this, error, options);
}
return false;
}
}
}(window, document));
|