|
|
|
@ -384,12 +384,29 @@ function readAttribute(parser: Parser, uniqueNames: Set<string>) {
|
|
|
|
|
|
|
|
|
|
parser.allowWhitespace();
|
|
|
|
|
|
|
|
|
|
let value = parser.eat('=') ? readAttributeValue(parser) : true;
|
|
|
|
|
const end = parser.index;
|
|
|
|
|
|
|
|
|
|
const colon_index = name.indexOf(':');
|
|
|
|
|
const type = colon_index !== 1 && get_directive_type(name.slice(0, colon_index));
|
|
|
|
|
|
|
|
|
|
let value;
|
|
|
|
|
|
|
|
|
|
if (parser.eat('=')) {
|
|
|
|
|
if (type === 'Binding') {
|
|
|
|
|
// TODO should this be a special case? tbh this whole thing
|
|
|
|
|
// could use a lil refactoring probably
|
|
|
|
|
const quote = parser.read(/['"']/);
|
|
|
|
|
const expression = readExpression(parser);
|
|
|
|
|
value = [{ type: 'MustacheTag', start: expression.start, end: expression.end, expression }];
|
|
|
|
|
|
|
|
|
|
if (quote) parser.eat(quote, true);
|
|
|
|
|
} else {
|
|
|
|
|
value = readAttributeValue(parser);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
value = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const end = parser.index;
|
|
|
|
|
|
|
|
|
|
if (type) {
|
|
|
|
|
name = name.slice(colon_index + 1);
|
|
|
|
|
|
|
|
|
@ -398,7 +415,7 @@ function readAttribute(parser: Parser, uniqueNames: Set<string>) {
|
|
|
|
|
end,
|
|
|
|
|
type,
|
|
|
|
|
name,
|
|
|
|
|
expression: value[0] && value[0].expression
|
|
|
|
|
[type === 'Binding' ? 'value' : 'expression']: value[0] && value[0].expression
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|