Skip to content

Commit

Permalink
Merge pull request #1022 from bem/bem-xjst-2x@v2
Browse files Browse the repository at this point in the history
Update templates to support bem-xjst 2.x
  • Loading branch information
Vyacheslav Aristov committed Jun 11, 2015
2 parents 83d4b4b + 215d36c commit 91a4e19
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 33 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
block('b1').def()(function() {
this.mods.foo = 'bar';
applyNext();
return applyNext();
});
block('b1').content()('foo bar');
block('b1').mod('foo', 'bar').content()('foo bar');
4 changes: 2 additions & 2 deletions common.blocks/page/page.bemhtml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ block('page')(
var ctx = this.ctx;
this._nonceCsp = ctx.nonce;

applyCtx([
return applyCtx([
ctx.doctype || '<!DOCTYPE html>',
{
tag : 'html',
Expand All @@ -16,7 +16,7 @@ block('page')(
{ tag : 'meta', attrs : { charset : 'utf-8' } },
ctx.uaCompatible === false? '' : {
tag : 'meta',
attrs: {
attrs : {
'http-equiv' : 'X-UA-Compatible',
content : ctx.uaCompatible || 'IE=edge'
}
Expand Down
52 changes: 23 additions & 29 deletions desktop.blocks/page/__css/page__css.bemhtml
Original file line number Diff line number Diff line change
@@ -1,30 +1,24 @@
block('page').elem('css')(
def()
.match(function() { return this.ctx.hasOwnProperty('ie'); })
.match(function() { return !this.ctx._ieCommented; })(
function() {
var ie = this.ctx.ie,
hideRule = !ie?
['gt IE 9', '<!-->', '<!--'] :
ie === '!IE'?
[ie, '<!-->', '<!--'] :
[ie, '', ''];
apply(
'',
{ 'ctx._ieCommented' : true },
{
ctx : [
'<!--[if ' + hideRule[0] + ']>' + hideRule[1],
this.ctx,
hideRule[2] + '<![endif]-->'
]
}
);
},
match(function() { return this.ctx.ie === true; })(function() {
var url = this.ctx.url;
applyCtx([6, 7, 8, 9].map(function(v) {
return { elem : 'css', url : url + '.ie' + v + '.css', ie : 'IE ' + v };
}));
}))
block('page').elem('css').def().match(function() {
return this.ctx.hasOwnProperty('ie');
})(
function() {
var ie = this.ctx.ie,
hideRule = !ie?
['gt IE 9', '<!-->', '<!--'] :
ie === '!IE'?
[ie, '<!-->', '<!--'] :
[ie, '', ''];

return applyCtx([
'<!--[if ' + hideRule[0] + ']>' + hideRule[1],
this.ctx,
hideRule[2] + '<![endif]-->'
]);
},
match(function() { return this.ctx.ie === true; })(function() {
var url = this.ctx.url;
return applyCtx([6, 7, 8, 9].map(function(v) {
return { elem : 'css', url : url + '.ie' + v + '.css', ie : 'IE ' + v };
}));
})
);
2 changes: 1 addition & 1 deletion touch.blocks/page/__icon/page__icon.bemhtml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
block('page').elem('icon').def()(function() {
var ctx = this.ctx;
applyCtx([
return applyCtx([
ctx.src16 && {
elem : 'link',
attrs : { rel : 'shortcut icon', href : ctx.src16 }
Expand Down

0 comments on commit 91a4e19

Please sign in to comment.