Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent binding with "with" helper #2129

Closed
wclr opened this issue Dec 9, 2015 · 2 comments
Closed

Inconsistent binding with "with" helper #2129

wclr opened this issue Dec 9, 2015 · 2 comments
Milestone

Comments

@wclr
Copy link
Contributor

wclr commented Dec 9, 2015

2.3.5 latest:

<script id="app-template" type="text/stache">
<comp-one>
  {{#with someMap}}
  <comp-two {attr-a}="attrA" {attr-b}="attrB" {^attr-c}="attrC"></comp-two>
  {{/with}}
</comp-one>
</script>
console.clear()
can.Component.extend({
  tag: "comp-one",
  template: can.stache('<content/>'),
  viewModel: {
    attrC: "",
    attrB: "ATTRB",
    someMap: {attrC: ""}
  }
});

can.Component.extend({
  tag: "comp-two",
  viewModel: {
    attrC: "ATTRC"
  } 
});


var outer = new can.Map({
  attrA: "ATTRA"
})

$("body").prepend(
  can.view("app-template",outer) 
);

//Sould comp-on scope attrC be 'ATTRC'?
//Sould comp-on scope someMap.attrC be 'ATTRC'?

console.log('comp-one', $("comp-one").viewModel().serialize() )
console.log('comp-two', $("comp-two").viewModel().serialize() )

http://jsbin.com/fejabegore/1/edit?html,js,console,output

{^attr-c}="attrC" seem to have place attrC on the parent scope, in example it doesn't place it nor on viewModel, nor on someMap that is set using {{#with someMap}}

2.3.4 gives an error with such example:
http://jsbin.com/yalutefuye/1/edit?html,js,console,output

I believe if we using "with" in this case attrC should be placed on viewModel, but I'm not sure.

@wclr
Copy link
Contributor Author

wclr commented Dec 9, 2015

this is related to #2122 and I think this as well #2092

@daffl daffl added this to the 2.3.7 milestone Dec 14, 2015
@justinbmeyer
Copy link
Contributor

Yeah, this should be fixed by #2139. Please re-open if you continue to find this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants