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

#each causing duplicates #1589

Closed
moschel opened this Issue Apr 2, 2015 · 1 comment

Comments

Projects
None yet
2 participants
@moschel
Contributor

moschel commented Apr 2, 2015

When #each is surrounded by a conditional section, which is a property with a setter, it causes the #each block to render duplicates. This description probably makes no sense, but I have a minimal breaking test to demonstrate this.

        var Map = can.Map.extend({
            define: {
                product: {
                    set: function(val){
                        return val;
                    }
                },
                people: {
                    get: function(list) {
                      var newList = new can.List();
                      newList.replace(['Brian']);
                      return newList;
                    }
                }
            }
        });
        var map = new Map();
        can.append( can.$("#qunit-fixture"), can.stache('{{#product}}{{#each people}}{{.}}{{/people}}{{/product}}')(map) );
        map.attr('product', "stuff");
        equal(can.$("#qunit-fixture")[0].innerHTML, "Brian", "no duplicates");

This will end up with "BrianBrian".

@daffl daffl added this to the 2.2.3 milestone Apr 2, 2015

@daffl

This comment has been minimized.

Show comment
Hide comment
@daffl

daffl Apr 2, 2015

Contributor

Fixed via #1590

Contributor

daffl commented Apr 2, 2015

Fixed via #1590

@daffl daffl closed this Apr 2, 2015

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