theironcook/Backbone.ModelBinder — pull request #35 by jankyco (2012-06-14 07:16:50+00:00)
Title: Fix for class setElAttribute with boolean model attributes

If a model defines a boolean attribute and this._model.previous(elementBinding.attributeBinding.attributeName) returns false for the previous boolean attribute value, then the the existing if statement fails to remove the previous class. I changed the condition to require a defined value.

Backbone function definition for previous could also return null

previous: function(attr) {
if (!arguments.length || !this._previousAttributes) return null;
return this._previousAttributes[attr];
}

I did not add a check for null as model attribute values could also be null.