Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion common.blocks/i-bem/i-bem.bemhtml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ var undef,
},
SHORT_TAGS = { // хэш для быстрого определения, является ли тэг коротким
area : 1, base : 1, br : 1, col : 1, command : 1, embed : 1, hr : 1, img : 1,
input : 1, keygen : 1, link : 1, meta : 1, param : 1, source : 1, wbr : 1 };
input : 1, keygen : 1, link : 1, meta : 1, param : 1, source : 1, wbr : 1 },
resetApplyNext = context.resetApplyNext || function() {};

(function(BEM, undefined) {

Expand Down Expand Up @@ -179,6 +180,7 @@ function BEMContext(context, apply_) {
this.elem = undef;
this.mods = undef;
this.elemMods = undef;
this._resetApplyNext = resetApplyNext;
}

BEMContext.prototype.isArray = isArray;
Expand Down Expand Up @@ -459,6 +461,7 @@ def()(function() {

var content = apply('content');
if(content || content === 0) {
this._resetApplyNext(this);
isBEM = vBlock || this.elem;
apply('', {
_notNewList : false,
Expand Down
5 changes: 4 additions & 1 deletion common.blocks/i-bem/i-bem.bemtree
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ var undef,
r = new RegExp(r, 'g');
return function(s) { return ('' + s).replace(r, f); };
};
})();
})(),
resetApplyNext = context.resetApplyNext || function() {};

context.BEMContext = BEMContext;

Expand All @@ -32,6 +33,7 @@ function BEMContext(context, apply_) {
this.elem = undef;
this.mods = undef;
this.elemMods = undef;
this._resetApplyNext = resetApplyNext;
}

BEMContext.prototype.isArray = isArray;
Expand Down Expand Up @@ -152,6 +154,7 @@ match(this._mode === '')(
def()(function() {
var content = apply('content');
if(content || content === 0) {
this._resetApplyNext(this);
this.ctx.content = apply('', { ctx : content });
}
return this.ctx;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
block('b1').def()(function() {
return local({ 'ctx.tag': 'span' })(function() {
return applyNext();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<span class="b1"><span class="b1"></span></span>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"block": "b1",
"content": {
"block": "b1"
}
}
1 change: 1 addition & 0 deletions common.blocks/i-bem/i-bem.test.bemhtml/i-bem-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,5 @@ suite('i-bem block and others', function() {
unit('mix with same block bem-core/804', 'gh-core-804');
unit('nested mix as object bem-core/873', 'gh-core-873');
unit('string mix', 'string-mix');
unit('reset apply next when entering content', 'reset-apply-next');
});
61 changes: 32 additions & 29 deletions common.blocks/page/page.bemhtml
Original file line number Diff line number Diff line change
@@ -1,37 +1,40 @@
block('page')(

def()(function() {
def().match(function() { return !this._pageInit; })(function() {
var ctx = this.ctx;
this._nonceCsp = ctx.nonce;

return applyCtx([
ctx.doctype || '<!DOCTYPE html>',
{
tag : 'html',
cls : 'ua_js_no',
content : [
{
elem : 'head',
content : [
{ tag : 'meta', attrs : { charset : 'utf-8' } },
ctx.uaCompatible === false? '' : {
tag : 'meta',
attrs : {
'http-equiv' : 'X-UA-Compatible',
content : ctx.uaCompatible || 'IE=edge'
}
},
{ tag : 'title', content : ctx.title },
{ block : 'ua', attrs : { nonce : ctx.nonce } },
ctx.head,
ctx.styles,
ctx.favicon? { elem : 'favicon', url : ctx.favicon } : ''
]
},
ctx
]
}
]);
// TODO(indunty): remove local after bem/bem-xjst#50
return local({ _pageInit : true })(function() {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@veged: moved it back to local because of bem/bem-xjst#50 . Throws error with current bem-xjst.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's add // TODO: remove local after bem/bem-xjst#50 then

return applyCtx([
ctx.doctype || '<!DOCTYPE html>',
{
tag : 'html',
cls : 'ua_js_no',
content : [
{
elem : 'head',
content : [
{ tag : 'meta', attrs : { charset : 'utf-8' } },
ctx.uaCompatible === false? '' : {
tag : 'meta',
attrs : {
'http-equiv' : 'X-UA-Compatible',
content : ctx.uaCompatible || 'IE=edge'
}
},
{ tag : 'title', content : ctx.title },
{ block : 'ua', attrs : { nonce : ctx.nonce } },
ctx.head,
ctx.styles,
ctx.favicon? { elem : 'favicon', url : ctx.favicon } : ''
]
},
ctx
]
}
]);
});
}),

tag()('body'),
Expand Down