From 145faa70047a2850bf9a60950ad9d335d695010c Mon Sep 17 00:00:00 2001 From: Fedor Indutny Date: Sun, 5 Jul 2015 17:29:31 -0700 Subject: [PATCH 1/2] i-bem: use resetApplyNext before entering `content` Skip all `applyNext()` flags before entering the `content` to support recursive blocks with `applyNext()` (see test). --- .../i-bem/__html/i-bem__html.bemhtml | 1 + blocks-desktop/b-page/b-page.bemhtml | 88 ++++++++++--------- package.json | 2 +- 3 files changed, 47 insertions(+), 44 deletions(-) diff --git a/blocks-common/i-bem/__html/i-bem__html.bemhtml b/blocks-common/i-bem/__html/i-bem__html.bemhtml index 4c047246..e0185835 100644 --- a/blocks-common/i-bem/__html/i-bem__html.bemhtml +++ b/blocks-common/i-bem/__html/i-bem__html.bemhtml @@ -472,6 +472,7 @@ default: { var content = apply(this._mode = 'content'); if(content || content === 0) { var isBEM = this.block || this.elem; + resetApplyNext(); apply( this._notNewList = false, this.position = isBEM ? 1 : this.position, diff --git a/blocks-desktop/b-page/b-page.bemhtml b/blocks-desktop/b-page/b-page.bemhtml index 1f294543..dc536e9a 100644 --- a/blocks-desktop/b-page/b-page.bemhtml +++ b/blocks-desktop/b-page/b-page.bemhtml @@ -7,49 +7,51 @@ block b-page { attrs: { 'http-equiv': 'X-UA-Compatible', content: this.ctx['x-ua-compatible'] || 'IE=edge' } } - default: { - var ctx = this.ctx, - dtype = apply('doctype'), - xUA = apply('xUACompatible'), - buf = [ - dtype, - { - elem: 'root', - content: [ - { - elem: 'head', - content: [ - ctx.csp && this.extend(ctx.csp, { elem: 'csp' }), - { - tag: 'meta', - attrs: { charset: 'utf-8' } - }, - xUA, - { - tag: 'title', - content: ctx.title - }, - ctx.favicon ? { - elem: 'favicon', - url: ctx.favicon - } : '', - ctx.meta, - { - block: 'i-ua', - attrs: { nonce: ctx.nonce } - }, - ctx.head - ] - }, - ctx - ] - } - ]; - - // For css and js elements and i-jquery, i-ua blocks - this._nonce = this.ctx.nonce; - - applyCtx(buf); + default, !this._pageInit: { + return local({ _pageInit: true })(function() { + var ctx = this.ctx, + dtype = apply('doctype'), + xUA = apply('xUACompatible'), + buf = [ + dtype, + { + elem: 'root', + content: [ + { + elem: 'head', + content: [ + ctx.csp && this.extend(ctx.csp, { elem: 'csp' }), + { + tag: 'meta', + attrs: { charset: 'utf-8' } + }, + xUA, + { + tag: 'title', + content: ctx.title + }, + ctx.favicon ? { + elem: 'favicon', + url: ctx.favicon + } : '', + ctx.meta, + { + block: 'i-ua', + attrs: { nonce: ctx.nonce } + }, + ctx.head + ] + }, + ctx + ] + } + ]; + + // For css and js elements and i-jquery, i-ua blocks + this._nonce = this.ctx.nonce; + + applyCtx(buf); + }); } tag: 'body' diff --git a/package.json b/package.json index af6e6d71..a13ce37b 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "version": "2.10.0", "private": true, "dependencies": { - "xjst": "~0.10.0", + "xjst": "~0.11.1", "ometajs": "~3.3.5", "dom-js": "~0.0.9", "estraverse": "~1.5.0", From e5430bfdcc51aa7efbee429ae0f78633d09ead56 Mon Sep 17 00:00:00 2001 From: Fedor Indutny Date: Sun, 5 Jul 2015 17:35:37 -0700 Subject: [PATCH 2/2] npm: update shrinkwrap --- npm-shrinkwrap.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index 6e9dcbf0..fc933500 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -63,8 +63,8 @@ } }, "xjst": { - "version": "0.10.0", - "from": "xjst@>=0.10.0 <0.11.0", + "version": "0.11.1", + "from": "xjst@>=0.11.1 <0.12.0", "dependencies": { "coa": { "version": "0.3.9",