Skip to content

Commit

Permalink
Merge pull request #652 from jccazeaux/fix-for-#644
Browse files Browse the repository at this point in the history
Fix callback calls. See #650. Regression since #546
  • Loading branch information
benadamstyles authored Aug 7, 2016
2 parents f30c0ec + f948204 commit a609bd8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
18 changes: 18 additions & 0 deletions spec/rivets/binders.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,24 @@ describe("Rivets.binders", function() {

Should(nestedEl.innerHTML).be.exactly("42");
});

it("does not throw when root scope is reset", function () {
el.setAttribute('rv-if', 'scope.error.errors');
el.innerHTML = '<div>{scope.error.errors.email}</div>';
model = {
scope: {
error: {
errors: {
email: 'not a valid address'
}
}
}
};
var view = rivets.bind(el, model);
(function(){
model.scope.error = {};
}).should.not.throw();
})
});

describe("Custom binder with no attribute value", function() {
Expand Down
2 changes: 1 addition & 1 deletion src/adapter.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ Rivets.public.adapters['.'] =
callbacks = map.callbacks

if callbacks[keypath]
cb() for cb in callbacks[keypath]
cb() for cb in callbacks[keypath].slice() when cb in callbacks[keypath]
@observeMutations newValue, obj[@id], keypath

unless callback in callbacks[keypath]
Expand Down

0 comments on commit a609bd8

Please sign in to comment.