Skip to content

Commit a256ef6

Browse files
author
Luiz Américo
committed
Pass model to valid/invalid callbacks thedersen#312
1 parent bb8f469 commit a256ef6

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/backbone-validation.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -243,11 +243,11 @@ Backbone.Validation = (function(_){
243243
_.each(attrs, _.bind(function (attr) {
244244
error = validateAttr(this, attr, flattened[attr], _.extend({}, this.attributes));
245245
if (error) {
246-
options.invalid(view, attr, error, options.selector);
246+
options.invalid(view, attr, error, options.selector, this);
247247
invalidAttrs = invalidAttrs || {};
248248
invalidAttrs[attr] = error;
249249
} else {
250-
options.valid(view, attr, options.selector);
250+
options.valid(view, attr, options.selector, this);
251251
}
252252
}, this));
253253
}, this));
@@ -287,10 +287,10 @@ Backbone.Validation = (function(_){
287287
changed = changedAttrs.hasOwnProperty(attr);
288288

289289
if(!invalid){
290-
opt.valid(view, attr, opt.selector);
290+
opt.valid(view, attr, opt.selector, model);
291291
}
292292
if(invalid && (changed || validateAll)){
293-
opt.invalid(view, attr, result.invalidAttrs[attr], opt.selector);
293+
opt.invalid(view, attr, result.invalidAttrs[attr], opt.selector, model);
294294
}
295295
});
296296
});

0 commit comments

Comments
 (0)