Skip to content

Commit

Permalink
Consider that boolean attributes does not nead to be escaped
Browse files Browse the repository at this point in the history
  • Loading branch information
ezhlobo committed Mar 5, 2018
1 parent b7f9ac3 commit b2cf339
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/visitors/Tag.js
Expand Up @@ -35,6 +35,16 @@ function getAttributes(
): Array<JSXAttribute | JSXSpreadAttribute> {
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));
Expand Down

0 comments on commit b2cf339

Please sign in to comment.