From b59c942e5a3c570e21ef4749df327a50532fe38c Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Mon, 28 Oct 2019 10:27:08 -0400 Subject: [PATCH] Revert "remove empty value declaration from style tree" --- package-lock.json | 6 +++--- package.json | 2 +- src/compiler/parse/read/style.ts | 6 +----- test/css/samples/empty-value/expected.css | 1 - test/css/samples/empty-value/input.svelte | 11 ----------- 5 files changed, 5 insertions(+), 21 deletions(-) delete mode 100644 test/css/samples/empty-value/expected.css delete mode 100644 test/css/samples/empty-value/input.svelte diff --git a/package-lock.json b/package-lock.json index 03196c32ee..cc5bd88a6d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1180,9 +1180,9 @@ "dev": true }, "estree-walker": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.9.0.tgz", - "integrity": "sha512-12U47o7XHUX329+x3FzNVjCx3SHEzMF0nkDv7r/HnBzX/xNTKxajBk6gyygaxrAFtLj39219oMfbtxv4KpaOiA==", + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.8.1.tgz", + "integrity": "sha512-H6cJORkqvrNziu0KX2hqOMAlA2CiuAxHeGJXSIoKA/KLv229Dw806J3II6mKTm5xiDX1At1EXCfsOQPB+tMB+g==", "dev": true }, "esutils": { diff --git a/package.json b/package.json index 6a82dc083d..a061cdf742 100644 --- a/package.json +++ b/package.json @@ -69,7 +69,7 @@ "eslint": "^6.3.0", "eslint-plugin-import": "^2.18.2", "eslint-plugin-svelte3": "^2.7.3", - "estree-walker": "^0.9.0", + "estree-walker": "^0.8.1", "is-reference": "^1.1.4", "jsdom": "^15.1.1", "kleur": "^3.0.3", diff --git a/src/compiler/parse/read/style.ts b/src/compiler/parse/read/style.ts index e658817a33..4a16475d6b 100644 --- a/src/compiler/parse/read/style.ts +++ b/src/compiler/parse/read/style.ts @@ -31,7 +31,7 @@ export default function read_style(parser: Parser, start: number, attributes: No // tidy up 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 if (node.type === 'Selector') { 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) { node.start = node.loc.start.offset; node.end = node.loc.end.offset; diff --git a/test/css/samples/empty-value/expected.css b/test/css/samples/empty-value/expected.css deleted file mode 100644 index 5bdbccf084..0000000000 --- a/test/css/samples/empty-value/expected.css +++ /dev/null @@ -1 +0,0 @@ -.bar.svelte-xyz{color:blue} \ No newline at end of file diff --git a/test/css/samples/empty-value/input.svelte b/test/css/samples/empty-value/input.svelte deleted file mode 100644 index 1262b8e08a..0000000000 --- a/test/css/samples/empty-value/input.svelte +++ /dev/null @@ -1,11 +0,0 @@ -
- - \ No newline at end of file