mikeric / rivets

Lightweight and powerful data binding.

Home Page:http://rivetsjs.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sightglass Default Adapter Iteration

milonas115 opened this issue · comments

Iterate the "change" callbacks backwards. Changes to the callbacks by custom binders will cause some parts of the loop to try to call an "undefined" function, or in the weird case, to skip a callback entirely.

if (weakmap[r].callbacks[k] instanceof Array)
{
	for(var i=weakmap[r].callbacks[k].length-1;i>=0;i--)
		weakmap[r].callbacks[k][i]();
}
if (callbacks[keypath])
{
	for(var i=callbacks[keypath].length-1;i>=0;i--)
		callbacks[keypath][i]();
}