From 676d8944627e496d8441eff5078e12dec15d1024 Mon Sep 17 00:00:00 2001 From: kinergy Date: Wed, 6 Nov 2013 01:28:33 -0800 Subject: [PATCH] fixed model unbind when model is also part of a collection of which other models have binding --- dist/backbone-validation-amd.js | 2 +- dist/backbone-validation.js | 2 +- src/backbone-validation.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dist/backbone-validation-amd.js b/dist/backbone-validation-amd.js index fd05e0e9..8ce9508f 100644 --- a/dist/backbone-validation-amd.js +++ b/dist/backbone-validation-amd.js @@ -354,7 +354,7 @@ if(model) { unbindModel(model); } - if(collection) { + else if(collection) { collection.each(function(model){ unbindModel(model); }); diff --git a/dist/backbone-validation.js b/dist/backbone-validation.js index bd781b92..c7efa12a 100644 --- a/dist/backbone-validation.js +++ b/dist/backbone-validation.js @@ -347,7 +347,7 @@ Backbone.Validation = (function(_){ if(model) { unbindModel(model); } - if(collection) { + else if(collection) { collection.each(function(model){ unbindModel(model); }); diff --git a/src/backbone-validation.js b/src/backbone-validation.js index b5f11f81..864ee0bb 100644 --- a/src/backbone-validation.js +++ b/src/backbone-validation.js @@ -340,7 +340,7 @@ Backbone.Validation = (function(_){ if(model) { unbindModel(model); } - if(collection) { + else if(collection) { collection.each(function(model){ unbindModel(model); });