Skip to content

Commit

Permalink
fixes canjs#2252 mostly by making scope_data optimized compute even m…
Browse files Browse the repository at this point in the history
…ore optimize
  • Loading branch information
justinbmeyer authored and BigAB committed Mar 7, 2016
1 parent f731be5 commit 9b6ebf8
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
2 changes: 1 addition & 1 deletion view/bindings/bindings.js
Original file line number Diff line number Diff line change
Expand Up @@ -846,7 +846,7 @@ steal("can/util",
updateParent,
updateChild,
childLifecycle;

if(bindingData.nodeList) {
if(parentCompute && parentCompute.isComputed){
parentCompute.computeInstance.setPrimaryDepth(bindingData.nodeList.nesting+1);
Expand Down
28 changes: 28 additions & 0 deletions view/bindings/bindings_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2202,6 +2202,34 @@ steal("can/view/bindings", "can/map", "can/test", "can/component", "can/view/sta

equal(logCalls, 1, "input rendered the right number of times");
});


test("Child bindings updated before parent (#2252)", function(){
var template = can.stache("{{#eq page 'view'}}<child-binder {page}='page'/>{{/eq}}");
can.Component.extend({
tag: 'child-binder',
template: can.stache('<span/>'),
viewModel: {
_set: function(prop, val){
if(prop === "page"){
equal(val,"view", "value should not be edit");
}

return can.Map.prototype._set.apply(this, arguments);
}
}
});

var vm = new can.Map({
page : 'view'
});
template(vm);

can.batch.start();
vm.attr('page', 'edit');
can.batch.stop();
});



test("Child bindings updated before parent (#2252)", function(){
Expand Down

0 comments on commit 9b6ebf8

Please sign in to comment.