From 010eb0600603b5404103fef1b6478ef51ddffbbd Mon Sep 17 00:00:00 2001 From: Dmitry Filatov Date: Tue, 25 Oct 2016 14:51:29 +0300 Subject: [PATCH] button: Don't render element for text if passed `null` or `undefined` --- common.blocks/button/button.bemhtml.js | 3 ++- common.blocks/button/button.bh.js | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/common.blocks/button/button.bemhtml.js b/common.blocks/button/button.bemhtml.js index f49dcfa4c..5bd2221e3 100644 --- a/common.blocks/button/button.bemhtml.js +++ b/common.blocks/button/button.bemhtml.js @@ -52,7 +52,8 @@ block('button')( var ctx = this.ctx, content = [ctx.icon]; // NOTE: wasn't moved to separate template for optimization - 'text' in ctx && content.push({ elem : 'text', content : ctx.text }); + /* jshint eqnull: true */ + ctx.text != null && content.push({ elem : 'text', content : ctx.text }); return content; }, match(function() { return typeof this.ctx.content !== 'undefined'; })(function() { diff --git a/common.blocks/button/button.bh.js b/common.blocks/button/button.bh.js index 256c30397..9c478ea62 100644 --- a/common.blocks/button/button.bh.js +++ b/common.blocks/button/button.bh.js @@ -27,7 +27,8 @@ module.exports = function(bh) { var content = ctx.content(); if(typeof content === 'undefined') { content = [json.icon]; - 'text' in json && content.push({ elem : 'text', content : json.text }); + /* jshint eqnull: true */ + json.text != null && content.push({ elem : 'text', content : json.text }); ctx.content(content); } });