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

Rendering models in tables produces different results than an equivalent observe #202

Closed
daffl opened this Issue Dec 10, 2012 · 0 comments

Comments

Projects
None yet
1 participant
@daffl
Contributor

daffl commented Dec 10, 2012

The following test renders

<table><tbody><tbody><tr></tr></tbody></tbody></table>

instead of the expected

<table><tbody><tr></tr></tbody></table>
test("Model Test", function() {
    var renderer = can.view.mustache('<table>{{#data}}<tbody>{{#rows}}<tr></tr>{{/rows}}</tbody>{{/data}}</table>');
    var div = document.createElement('div');
    var dom = renderer({
        data : new can.Model({
            rows: [{ name : 'first' }]
        })
    });
    div.appendChild(dom);
    var expected = "<table><tbody><tr></tr></tbody></table>";
    same(div.innerHTML, expected);
});

Setting the data to a can.Observe renders the expected output as well as changing the template to

<table><tbody>{{#data}}{{#rows}}<tr></tr>{{/rows}}{{/data}}</tbody></table>

Or

<table><tbody>{{#data.rows}}<tr></tr>{{/data.rows}}</tbody></table>

@daffl daffl closed this in 6d1a372 Dec 10, 2012

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