Skip to content

Commit

Permalink
add support for empty attribute values
Browse files Browse the repository at this point in the history
  • Loading branch information
kbrsh committed Apr 28, 2019
1 parent 66a82f4 commit dc07891
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/moon/dist/moon.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@
} else {
// Store the key/value pair using the matched value or
// expression.
attributes[attributeKey] = attributeExpression === undefined ? attributeValue : scopeExpression(attributeExpression); // Add a wrapper function for events.
attributes[attributeKey] = attributeExpression === undefined ? attributeValue === undefined ? "\"\"" : attributeValue : scopeExpression(attributeExpression); // Add a wrapper function for events.

if (attributeKey[0] === "@") {
attributes[attributeKey] = "function($event){" + attributes[attributeKey] + "}";
Expand Down
2 changes: 1 addition & 1 deletion packages/moon/dist/moon.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion packages/moon/src/compiler/lexer/lexer.js
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,9 @@ export function lex(input) {
// expression.
attributes[attributeKey] =
attributeExpression === undefined ?
attributeValue :
attributeValue === undefined ?
"\"\"" :
attributeValue :
scopeExpression(attributeExpression);

// Add a wrapper function for events.
Expand Down

0 comments on commit dc07891

Please sign in to comment.