bem / bem-xjst

bem-xjst (eXtensible JavaScript Templates): declarative template engine for the browser and server
https://bem.github.io/bem-xjst
Other
115 stars 47 forks source link

applyNext() inconsistence between 1.2.1 and 4.0.1 versions #84

Closed tadatuta closed 9 years ago

tadatuta commented 9 years ago

For BEMJSON

{
    block: 'b1',
    key: 'outside',
    key2: {
        block: 'b1',
        key: 'inside',
        key2: ''
    }
}

and template

block('b1')(
    def()(function() {
        return applyNext({
            _key: this.ctx.key
        });
    }),
    content()(function() {
        return [
            this.ctx.key2,
            { elem: 'key2' }
        ];
    }),
    elem('key2').content()(function() {
        return this._key;
    })
);

with bem-xjst 4.0.1 I've got

<div class="b1"><div class="b1"><div class="b1__key2">inside</div></div><div class="b1__key2">outside</div></div>

which looks just fine and with bem-xjst 1.2.1 the result is

<div class="b1"><div class="b1"><div class="b1__key2">outside</div></div><div class="b1__key2">outside</div></div>
indutny commented 9 years ago

This is because of the skipApplyNext vs resetApplyNext. Haha! cc @veged , we finally found a test case for that change ;)

I guess we want to fix it?