bem / bem-bl

Base BEM library
http://bem.github.com/bem-bl/
198 stars 84 forks source link

BEMHTML: Не выставляется гард `!this.elem` в кастомном предикате #341

Closed narqo closed 11 years ago

narqo commented 11 years ago

В #310 не портировали добавление !this.elem при наличии js-выражения в касотмном предикате:

block b-page {

    content, !this.ctx._mmm: {
        console.log(this.block, this.elem, '+++++++++++++++');
    }

}

Для bem-bl/0.3 компилируется:

....
if (__t === "content") {
    var __t = this.block;
    if (__t === "b-page") {
        if (!!this.ctx._mmm === false) {
            if (!!this.elem === false) {               // <---- !this.elem
                console.log(this.block, this.elem, "+++++++++++++++");
                return;
            } else {
                return $114.call(this);
            }
        } else {
            return $114.call(this);
        }
    ....

для bem-bl/0.2 (xjst@0.4.5, ometajs@3.2.4):

....                                                                                                                                                                                                        
if (__t === "content") {
    if (!(this.block === "b-page") === false) {
        if (!!this.ctx._mmm === false) {
            console.log(this.block, this.elem, "+++++++++++++++");
            return;
        } else {
            return $121.call(this);
        }
    } else {
        return $121.call(this);
    }
    ....
narqo commented 11 years ago

\cc @vtambourine