bem/bem-xjst

appendContent/prependContent escapes html

golyshevd opened this issue · 3 comments

bemjson

{
    block: 'foo'
}

bemhtml

block('foo')(
    prependContent()(() => ({
        elem: 'x', 
        content: 'before'
    })),
    appendContent()(() => ({
        elem: 'x', 
        content: 'after'
    }))
);

result

<div class="foo">&lt;div class="foo__x"&gt;before&lt;/div&gt;&lt;div class="foo__x"&gt;after&lt;/div&gt;</div>

Live example https://goo.gl/5wXovY


guess appendContent/prependContent is just sugar for content + applyNext, but this behaviour is unexpected

BTW, in this case you don’t need use arrow function at all.

block('foo')(
    prependContent()({
        elem: 'x', 
        content: 'before'
    }),
    appendContent()({
        elem: 'x', 
        content: 'after'
    })
);

I detect that bug exists only with arrow function…

qfox commented

Same with usual functions: https://goo.gl/82s0Hr

@zxqfox of course. And I fixed it already.