Merge pull request #3818 from sveltejs/gh-3801

error on empty css declarations
pull/7738/head
Rich Harris 6 years ago committed by GitHub
commit 66de45a085

@ -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) { if (node.loc) {
node.start = node.loc.start.offset; node.start = node.loc.start.offset;
node.end = node.loc.end.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