8000 Only binds to a collection when a model is not present on the view. F… · thedersen/backbone.validation@7d40c33 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7d40c33

Browse files
committed
Only binds to a collection when a model is not present on the view. Fixes #89
1 parent 529d33e commit 7d40c33

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

dist/backbone-validation-amd-min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/backbone-validation-amd.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@
313313
if(model) {
314314
bindModel(view, model, options);
315315
}
316-
if(collection) {
316+
else if(collection) {
317317
collection.each(function(model){
318318
bindModel(view, model, options);
319319
});
@@ -356,7 +356,7 @@
356356
// view becomes valid. Removes any error message.
357357
// Should be overridden with custom functionality.
358358
valid: function(view, attr, selector) {
359-
view.$('[' + selector + '~=' + attr + ']')
359+
view.$('[' + selector + '~="' + attr + '"]')
360360
.removeClass('invalid')
361361
.removeAttr('data-error');
362362
},
@@ -365,7 +365,7 @@
365365
// Adds a error message.
366366
// Should be overridden with custom functionality.
367367
invalid: function(view, attr, error, selector) {
368-
view.$('[' + selector + '~=' + attr + ']')
368+
view.$('[' + selector + '~="' + attr + '"]')
369369
.addClass('invalid')
370370
.attr('data-error', error);
371371
}

0 commit comments

Comments
 (0)
0