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

wrong `isLast()` result #99

Closed mishanga closed 9 years ago

mishanga commented 9 years ago

template

block('z-weather').elem('tile')(
    match(function() { return !this.mods.layout; })
        .tag()('td'),
    match(function() { return this.isLast(); })
        .mix()({ elemMods: { position: 'last' } })
);

bemjson

[{
    tag: 'table',
    content: {
        block: 'z-weather',
        tag: 'tr',
        content: [
            { elem: 'tile', content: 'cell' },
            { elem: 'tile', content: 'last cell' }
        ]
    }
},
{
    block: 'z-weather',
    elem: 'tile',
    mods: { layout: 'yes' },
    content: 'with layout mode'
},
{
    block: 'z-weather',
    elem: 'tile',
    mods: { layout: 'yes' },
    content: 'Last with layout mode'
}];

expected result

<table>...</table>
<div class="z-weather__tile z-weather__tile_layout_yes">with layout mode</div>
<div class="z-weather__tile z-weather__tile_layout_yes z-weather__tile_position_last">Last with layout mode</div>

actual result

<table>...</table>
<div class="z-weather__tile z-weather__tile_layout_yes z-weather__tile_position_last">with layout mode</div>
<div class="z-weather__tile z-weather__tile_layout_yes">Last with layout mode</div>
mishanga commented 9 years ago

В простом случае, когда просто массив из двух и более элементов, не воспроизводится.

voischev commented 9 years ago

странненько

indutny commented 9 years ago

Fixed, thank you!

mishanga commented 9 years ago

:+1: