Skip to content

Commit

Permalink
Consume binders array as we process it.
Browse files Browse the repository at this point in the history
Ensures that we both process newly added binders from bo-if, and that
we only process each binder once.
  • Loading branch information
Chris Tucker committed Jan 20, 2014
1 parent 004000b commit e091c27
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions bindonce.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,13 @@
}
},

runBinders: function ()
runBinders : function()
{
var i, max;
for (i = 0, max = this.binders.length; i < max; i++)
{
var binder = this.binders[i];
if (this.group && this.group !== binder.group) continue;
while(this.binders.length > 0) {
var binder = this.binders.shift();
if (this.group && this.group != binder.group ) continue;
var value = binder.scope.$eval((binder.interpolate) ? $interpolate(binder.value) : binder.value);
switch (binder.attr)
switch(binder.attr)
{
case 'if':
if (toBoolean(value))
Expand Down Expand Up @@ -269,4 +267,4 @@
return bindonceDirective;
});
});
})();
})();

0 comments on commit e091c27

Please sign in to comment.