karlvr/consistent.js — pull request #6 by snikch (2013-08-23 06:24:19+00:00)
Title: Fix bug where function result not applied to scope

Given the following

```javascript
// Simplified for brevity and non coffee-ness
template = $('

')
scope = template.consistent({valueFunctionPrefix: "get"})
scope.getActive = function(){
return this.state == 'active';
}
scope.$toggleState = function(ev, scope){
if(scope.state == 'active'){
scope.state = 'inactive';
}else{
scope.state = 'active';
}
scope.$.apply();
}
```

The toggle state would never change from its initial value. Adding `delete this.active` to the `getActive` method showed that this seemed to be an issue with the element being saved, then reference rather than reevaluated.

Tracking it down in the code, I fixed the issue with this patch. I'm not sure what the actual issue is here, perhaps it's to do with the nested scopes? Perhaps not? This might not be the best solution, but it solved a few hours of frustrations :)