bem / bh

BH template engine
http://bem.github.io/bh/
MIT License
68 stars 31 forks source link

Bug with ctx.js() #160

Closed arikon closed 9 years ago

arikon commented 9 years ago
// ({block: 'block'})

bh.match('block', function(ctx) {
    ctx.js(false);
    ctx.js(true);
});

// <div class="block i-bem" data-bem='{"block":{}}'></div>

After the second call to ctx.js(true) the value of js is true. Should be false.

js() implementation in BH: https://github.com/bem/bh/blob/master/lib/bh.js#L437-L445 It seems that after the first call json.js stays undefined. On the second call this happens: this.extend(undefined, true) And then returns this: https://github.com/bem/bh/blob/master/lib/bh.js#L92

qfox commented 9 years ago

this.ctx.js = force ?this.ctx.js = force || this.ctx.js === undefined ? plus specs?

arikon commented 9 years ago

@mishanga Thanks!

arikon commented 9 years ago

@mishanga А в bh 3.x есть такая ошибка? Если да, то мы не сможем из islands оторвать костылик про это.

mishanga commented 9 years ago

@arikon да, выпустил 3.3.1

arikon commented 9 years ago

@mishanga Спасибо!

mishanga commented 9 years ago

@arikon блин, не так сделал. Выпущу пакет bh-3x с этим фиксом.