SteveSanderson/knockout — Issue #187: Multiple inits called on binding
Author: jschr
Created: 2011-10-31 19:39:01+00:00
State: open

As per this [thread](http://groups.google.com/group/knockoutjs/browse_thread/thread/0f00b66aab9b69ad), I believe there is a problem when creating the dependent observable for each data-bind.

I've noticed that there's the potential for an init function of a binding to be called multiple times, especially if the 'value' binding is being used. It seems like the simple solution is to set 'isFirstEvaluation' before calling the inits/updates for a binding instead of setting it after the creation of the dependent observable. I.e:

```javascript
if (parsedBindings) {
// First run all the inits, so bindings can register for notification on changes
if (isFirstEvaluation) {
isFirstEvaluation = false; //fix for multiple inits being called
for (var bindingKey in parsedBindings) {
... run inits
}
}
```

I also updated the [jsFiddle](http://jsfiddle.net/uDs4f/13/) to better demonstrate the issue