Helpers bind to nested properties differently in stache/mustache #1651

Closed
akagomez opened this Issue Apr 28, 2015 · 7 comments

Comments

Projects
None yet
3 participants
@akagomez
Contributor

akagomez commented Apr 28, 2015

Test: 68d438b

@kylegifford

This comment has been minimized.

Show comment
Hide comment
@kylegifford

kylegifford Apr 30, 2015

Contributor

To clarify the problem a bit:

Binding via dot syntax (this.attr('parent.child')):

  • works with this.attr('parent.child', 'foo')
  • does not work with this.attr('parent', {'child': 'foo'})

NOTE: the dot syntax test is also failing for mustache

Binding via nested attrs (this.attr('parent').attr('child')):

  • works with this.attr('parent', {'child': 'foo'})
  • does not work with this.attr('parent.child', 'foo')
Contributor

kylegifford commented Apr 30, 2015

To clarify the problem a bit:

Binding via dot syntax (this.attr('parent.child')):

  • works with this.attr('parent.child', 'foo')
  • does not work with this.attr('parent', {'child': 'foo'})

NOTE: the dot syntax test is also failing for mustache

Binding via nested attrs (this.attr('parent').attr('child')):

  • works with this.attr('parent', {'child': 'foo'})
  • does not work with this.attr('parent.child', 'foo')
@akagomez

This comment has been minimized.

Show comment
Hide comment
@akagomez

akagomez Apr 30, 2015

Contributor

@kylegifford I think my fix here in #1655 will at least make the two tests consistent.

Contributor

akagomez commented Apr 30, 2015

@kylegifford I think my fix here in #1655 will at least make the two tests consistent.

@akagomez

This comment has been minimized.

Show comment
Hide comment
@akagomez

akagomez Apr 30, 2015

Contributor

I don't think binding to...

var map = new can.Map({
  parent: null
})

With...

map.attr('parent.child')

And expecting that to work after....

map.attr({ parent: { child: 'foo' }}); 

...Is officially supported. Although, I certainly wish it was. Either way I think it's a separate issue.

Contributor

akagomez commented Apr 30, 2015

I don't think binding to...

var map = new can.Map({
  parent: null
})

With...

map.attr('parent.child')

And expecting that to work after....

map.attr({ parent: { child: 'foo' }}); 

...Is officially supported. Although, I certainly wish it was. Either way I think it's a separate issue.

@kylegifford

This comment has been minimized.

Show comment
Hide comment
@kylegifford

kylegifford Apr 30, 2015

Contributor

After applying the fix in #1655 the tests work consistently between Stache and Mustache, and binding via nested attrs now works correctly in Stache. Both still fail using dot syntax mentioned above.

@akagomez can this be closed (after cleaning up tests) since this is working consistently in both Stache and Mustache?

Contributor

kylegifford commented Apr 30, 2015

After applying the fix in #1655 the tests work consistently between Stache and Mustache, and binding via nested attrs now works correctly in Stache. Both still fail using dot syntax mentioned above.

@akagomez can this be closed (after cleaning up tests) since this is working consistently in both Stache and Mustache?

@akagomez

This comment has been minimized.

Show comment
Hide comment
@akagomez

akagomez Apr 30, 2015

Contributor

That makes sense to me. I'll create a new issue for the dot syntax binding.

Contributor

akagomez commented Apr 30, 2015

That makes sense to me. I'll create a new issue for the dot syntax binding.

kylegifford added a commit that referenced this issue Apr 30, 2015

@kylegifford

This comment has been minimized.

Show comment
Hide comment
@kylegifford

kylegifford Apr 30, 2015

Contributor

Tests added to #1655 .

Contributor

kylegifford commented Apr 30, 2015

Tests added to #1655 .

kylegifford added a commit that referenced this issue Apr 30, 2015

@daffl daffl added this to the 2.2.6 milestone May 11, 2015

kylegifford added a commit that referenced this issue May 13, 2015

@daffl

This comment has been minimized.

Show comment
Hide comment
@daffl

daffl May 13, 2015

Contributor

Closed via #1655

Contributor

daffl commented May 13, 2015

Closed via #1655

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment