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

this.mods is kept down the tree #80

Closed tadatuta closed 9 years ago

tadatuta commented 9 years ago

For BEMJSON { block: 'b1' } and template

block('b1')(
    def()(function() {
        this.mods.m1 = 'v1';
        return applyNext();
    }),
    content()([
        {
            block: 'b2'
        }
    ])
);

result is

<div class="b1 b1_m1_v1"><div class="b2 b2_m1_v1"></div></div>

but

<div class="b1 b1_m1_v1"><div class="b2"></div></div>

expected.

indutny commented 9 years ago

You have to use local. And yeah, it is this way at the moment.

I'll do benchmarks to see if creating mods for each block will be much slower than what we have now.

indutny commented 9 years ago

Fixed in 3c7f239

indutny commented 9 years ago

No performance loss seen