Revert "remove empty value declaration from style tree"

pull/3817/head
Rich Harris 5 years ago committed by GitHub
parent b6f4c23161
commit b59c942e5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

6
package-lock.json generated

@ -1180,9 +1180,9 @@
"dev": true "dev": true
}, },
"estree-walker": { "estree-walker": {
"version": "0.9.0", "version": "0.8.1",
"resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.9.0.tgz", "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.8.1.tgz",
"integrity": "sha512-12U47o7XHUX329+x3FzNVjCx3SHEzMF0nkDv7r/HnBzX/xNTKxajBk6gyygaxrAFtLj39219oMfbtxv4KpaOiA==", "integrity": "sha512-H6cJORkqvrNziu0KX2hqOMAlA2CiuAxHeGJXSIoKA/KLv229Dw806J3II6mKTm5xiDX1At1EXCfsOQPB+tMB+g==",
"dev": true "dev": true
}, },
"esutils": { "esutils": {

@ -69,7 +69,7 @@
"eslint": "^6.3.0", "eslint": "^6.3.0",
"eslint-plugin-import": "^2.18.2", "eslint-plugin-import": "^2.18.2",
"eslint-plugin-svelte3": "^2.7.3", "eslint-plugin-svelte3": "^2.7.3",
"estree-walker": "^0.9.0", "estree-walker": "^0.8.1",
"is-reference": "^1.1.4", "is-reference": "^1.1.4",
"jsdom": "^15.1.1", "jsdom": "^15.1.1",
"kleur": "^3.0.3", "kleur": "^3.0.3",

@ -31,7 +31,7 @@ export default function read_style(parser: Parser, start: number, attributes: No
// tidy up AST // tidy up AST
walk(ast, { walk(ast, {
enter(node: any) { // `any` because this isn't an ESTree node enter: (node: any) => { // `any` because this isn't an ESTree node
// replace `ref:a` nodes // replace `ref:a` nodes
if (node.type === 'Selector') { if (node.type === 'Selector') {
for (let i = 0; i < node.children.length; i += 1) { for (let i = 0; i < node.children.length; i += 1) {
@ -47,10 +47,6 @@ export default function read_style(parser: Parser, start: number, attributes: No
} }
} }
if (node.type === 'Declaration' && node.value.type === 'Value' && node.value.children.length === 0) {
this.remove();
}
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;

@ -1 +0,0 @@
.bar.svelte-xyz{color:blue}

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