bem / bem-xjst

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

[1.x] elemMatch: this.elem is undefined #100

Closed blond closed 9 years ago

blond commented 9 years ago

Versions:

Template:

elemMatch(function() { return this.elem.indexOf('inner') === 0; }).content()(function() {
    return [
        { elem : 'label', content : this.elem.slice(-1) },
        this.ctx.content
    ];
})

After build of BEMHTML bundle in production mode and call BEMHTML.apply() is the error:

TypeError: Cannot read property 'indexOf' of undefined
    at BEMContext.<anonymous> (/Users/blond/projects/bem-core/desktop.tests/jquery__event_type_pointernative/simple/.tmp.bemhtml.js:121:33)
    at applyc (/Users/blond/projects/bem-core/desktop.tests/jquery__event_type_pointernative/simple/.tmp.bemhtml.js:122:15)
    at __$b32 (/Users/blond/projects/bem-core/desktop.tests/jquery__event_type_pointernative/simple/.tmp.bemhtml.js:636:21)
    at applyc (/Users/blond/projects/bem-core/desktop.tests/jquery__event_type_pointernative/simple/.tmp.bemhtml.js:177:20)
    at __$b40 (/Users/blond/projects/bem-core/desktop.tests/jquery__event_type_pointernative/simple/.tmp.bemhtml.js:738:5)
    at applyc (/Users/blond/projects/bem-core/desktop.tests/jquery__event_type_pointernative/simple/.tmp.bemhtml.js:202:20)
    at __$b32 (/Users/blond/projects/bem-core/desktop.tests/jquery__event_type_pointernative/simple/.tmp.bemhtml.js:653:25)
    at applyc (/Users/blond/projects/bem-core/desktop.tests/jquery__event_type_pointernative/simple/.tmp.bemhtml.js:177:20)
    at __$b40 (/Users/blond/projects/bem-core/desktop.tests/jquery__event_type_pointernative/simple/.tmp.bemhtml.js:738:5)
    at applyc (/Users/blond/projects/bem-core/desktop.tests/jquery__event_type_pointernative/simple/.tmp.bemhtml.js:202:20)

More see in bem-core: https://github.com/bem/bem-core/issues/1181

arikon commented 9 years ago

Will not be fixed in favor of bem-xjst@4.x.

bem-xjst@4.x will be checked here https://github.com/bem/bem-xjst/issues/109.