-
Notifications
You must be signed in to change notification settings - Fork 396
Open
Description
Description:
I remember (but I'm unsure) that we could use {{#with foo}} to set the context to foo. It still works the same way, but not with nested structures. Why is that?
Versions affected:
1.4
Platforms affected:
Browser
Reproduction:
Ractive({
el: 'body',
append: true,
data: {
foo: {
}
},
template: `
<!-- context becomes foo -->
{{#with foo as f}}
<input value="{{f.hello}}" />
{{#with f.bar as b}}
<input value="{{b.yay}}" />
{{/with}}
{{/with}}
`,
onrender: function(){
console.log(JSON.stringify(this.get()))
}
})This code prints the expected output: {"foo":{"bar":{"yay":""},"hello":""}}
However, this simplified version produces an undesired result:
Ractive({
el: 'body',
append: true,
data: {
foo: {
}
},
template: `
<!-- context becomes foo -->
{{#with foo}}
<input value="{{hello}}" />
{{#with bar}}
<input value="{{yay}}" />
{{/with}}
{{/with}}
`,
onrender: function(){
console.log(JSON.stringify(this.get()))
}
})```
Outputs: `{"foo":{"hello":""}}`
Is this behavior expected?Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels