Add error for missing equals after attribute name

pull/2770/head
Emil Tholin 5 years ago
parent fbb6c9fd4e
commit 3f31223186

@ -358,7 +358,7 @@ function read_attribute(parser: Parser, unique_names: Set<string>) {
}
}
let name = parser.read_until(/(\s|=|\/|>)/);
let name = parser.read_until(/[\s=\/>"']/);
if (!name) return null;
let end = parser.index;
@ -383,6 +383,11 @@ function read_attribute(parser: Parser, unique_names: Set<string>) {
if (parser.eat('=')) {
value = read_attribute_value(parser);
end = parser.index;
} else if (parser.match_regex(/["']/)) {
parser.error({
code: `unexpected-token`,
message: `Expected =`
}, parser.index);
}
if (type) {

@ -0,0 +1,15 @@
[{
"code": "unexpected-token",
"message": "Expected =",
"start": {
"line": 5,
"column": 9,
"character": 50
},
"end": {
"line": 5,
"column": 9,
"character": 50
},
"pos": 50
}]

@ -0,0 +1,5 @@
<script>
let name = 'world';
</script>
<h1 class"=foo">Hello {name}!</h1>
Loading…
Cancel
Save