From b2cf339c2925ca2f4ef8c6b2d464036547308e31 Mon Sep 17 00:00:00 2001 From: Eugene Zhlobo Date: Mon, 5 Mar 2018 22:38:07 +0300 Subject: [PATCH] Consider that boolean attributes does not nead to be escaped --- src/visitors/Tag.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/visitors/Tag.js b/src/visitors/Tag.js index 31edbc7..21a5ab6 100644 --- a/src/visitors/Tag.js +++ b/src/visitors/Tag.js @@ -35,6 +35,16 @@ function getAttributes( ): Array { const classes = []; const attrs = node.attrs + .map(node => { + if (node.val === true) { + return { + ...node, + mustEscape: false, + }; + } + + return node; + }) .map(({name, val, mustEscape}) => { if (/\.\.\./.test(name) && val === true) { return t.jSXSpreadAttribute(parseExpression(name.substr(3), context));