error on empty css declarations - fixes #3801

pull/3818/head
Richard Harris 5 years ago
parent e55bf4013d
commit 74fa2447b1

@ -47,6 +47,13 @@ export default function read_style(parser: Parser, start: number, attributes: No
}
}
if (node.type === 'Declaration' && node.value.type === 'Value' && node.value.children.length === 0) {
parser.error({
code: `invalid-declaration`,
message: `Declaration cannot be empty`
}, node.start);
}
if (node.loc) {
node.start = node.loc.start.offset;
node.end = node.loc.end.offset;

@ -0,0 +1,12 @@
[{
"code": "invalid-declaration",
"message": "Declaration cannot be empty",
"start": {
"line": 11, "column": 0, "character": 93
},
"end": {
"line": 11, "column": 0, "character": 93
},
"pos": 93,
"frame": " 9: color: blue;\n10: }\n11: </style>\n ^"
}]

@ -0,0 +1,11 @@
<div class='foo bar'></div>
<style>
.foo {
color:;
}
.bar {
font:;
color: blue;
}
</style>
Loading…
Cancel
Save