diff --git a/lib/component-attributes-transform.js b/lib/component-attributes-transform.js index 1ebd4dd..fec8b1d 100644 --- a/lib/component-attributes-transform.js +++ b/lib/component-attributes-transform.js @@ -3,12 +3,14 @@ /* ```hbs + {{my-component (html-attributes data-qux="quax" class="horse" id="pony")}} {{my-component (attributes data-foo="bar" class="cat" id="dog")}} ``` becomes ```hbs + {{my-component class="horse" id="pony" __HTML_ATTRIBUTES__=(hash data-qux="quax") }} {{my-component class="cat" id="dog" __HTML_ATTRIBUTES__=(hash data-foo="bar") }} ``` */ @@ -30,7 +32,7 @@ AttributesExpressionTransform.prototype.transform = function(ast) { }); function transform(curly) { - if (hasAttributesExpression(curly)) { + if (hasHTMLAttributesExpression(curly)) { let attributes = curly.params.pop(); let pairs = attributes.hash.pairs; @@ -65,10 +67,13 @@ AttributesExpressionTransform.prototype.transform = function(ast) { } } - function hasAttributesExpression(curly) { + function hasHTMLAttributesExpression(curly) { if (curly.params.length > 0) { let last = curly.params[curly.params.length - 1]; - if (last.type === "SubExpression" && last.path.original === "attributes") { + if ( + last.type === "SubExpression" && + (last.path.original === "html-attributes" || last.path.original === "attributes") + ) { return true; } }