Skip to content

v8.2.0

Compare
Choose a tag to compare
@miripiruni miripiruni released this 11 Oct 12:46
· 333 commits to master since this release

With option omitOptionalEndTags template engine will ommit
optional end tags. The option is turn off by default.

You can find list of optional end tags in specifications: HTML4 and HTML5.

var bemxjst = require('bem-xjst');
var templates = bemxjst.bemhtml.compile(function() {
    // In this example we will add no templates.
    // Default behaviour is used for HTML rendering.
    }, {
        // Turn off optional end tags
        omitOptionalEndTags: true
    });

var bemjson = {
    tag: 'table',
    content: {
        tag: 'tr',
        content: [
            { tag: 'th', content: 'table header' },
            { tag: 'td', content: 'table cell' }
        ]
    }
};

var html = templates.apply(bemjson);

Result:

<table><tr><th>table header<td>table cell</table>

Commits:

  • [207b3733de] - Merge pull request #361 from bem/issue-360__optional-closing-tags (Slava Oliyanchuk)
  • [042dcb1385] - BEMHTML: Omit optional closing tags (fix for #360) (miripiruni)