From fc5b329ac439a80eb60e87d52f26dcb1180ed6ae Mon Sep 17 00:00:00 2001 From: miripiruni Date: Thu, 9 Feb 2017 14:13:20 +0300 Subject: [PATCH] More squeeze --- lib/bemxjst/index.js | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/lib/bemxjst/index.js b/lib/bemxjst/index.js index 11b0af22..7344ffb2 100644 --- a/lib/bemxjst/index.js +++ b/lib/bemxjst/index.js @@ -242,10 +242,7 @@ BEMXJST.prototype.transformEntities = function(entities) { continue; var entity = entities[key]; - if (entity.block !== block) - continue; - - if (entity.elem === undefined) + if (entity.block !== block || entity.elem === undefined) continue; entities[key].prepend(wildcard); @@ -265,11 +262,10 @@ BEMXJST.prototype.transformEntities = function(entities) { }; BEMXJST.prototype._run = function(context) { - var res; if (context === undefined || context === '' || context === null) - res = this.runEmpty(); + return this.runEmpty(); else if (Array.isArray(context)) - res = this.runMany(context); + return this.runMany(context); else if ( typeof context.html === 'string' && !context.tag && @@ -278,12 +274,11 @@ BEMXJST.prototype._run = function(context) { typeof context.cls === 'undefined' && typeof context.attrs === 'undefined' ) - res = this.runUnescaped(context); + return this.runUnescaped(context); else if (utils.isSimple(context)) - res = this.runSimple(context); - else - res = this.runOne(context); - return res; + return this.runSimple(context); + + return this.runOne(context); }; BEMXJST.prototype.run = function(json) { @@ -377,10 +372,8 @@ BEMXJST.prototype.runOne = function(json) { // To invalidate `applyNext` flags this.depth++; - var key = this.classBuilder.build(block, elem); - var restoreFlush = false; - var ent = this.entities[key]; + var ent = this.entities[this.classBuilder.build(block, elem)]; if (ent) { if (this.canFlush && !ent.canFlush) { // Entity does not support flushing, do not flush anything nested