From a88a4feb861943bc9358e1d7e997f84197c5bed7 Mon Sep 17 00:00:00 2001 From: Yuji Sugiura Date: Sun, 1 May 2022 02:57:49 +0900 Subject: [PATCH] [fix] do not be over-eager in removing unused CSS for dialog[open] (#7495) --- src/compiler/compile/css/Selector.ts | 3 ++- .../samples/attribute-selector-dialog-open/expected.css | 1 + .../samples/attribute-selector-dialog-open/input.svelte | 7 +++++++ 3 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 test/css/samples/attribute-selector-dialog-open/expected.css create mode 100644 test/css/samples/attribute-selector-dialog-open/input.svelte diff --git a/src/compiler/compile/css/Selector.ts b/src/compiler/compile/css/Selector.ts index d9868f453060..5123f6fec43a 100644 --- a/src/compiler/compile/css/Selector.ts +++ b/src/compiler/compile/css/Selector.ts @@ -21,7 +21,8 @@ enum NodeExist { } const whitelist_attribute_selector = new Map([ - ['details', new Set(['open'])] + ['details', new Set(['open'])], + ['dialog', new Set(['open'])] ]); export default class Selector { diff --git a/test/css/samples/attribute-selector-dialog-open/expected.css b/test/css/samples/attribute-selector-dialog-open/expected.css new file mode 100644 index 000000000000..54d85c4ee8f2 --- /dev/null +++ b/test/css/samples/attribute-selector-dialog-open/expected.css @@ -0,0 +1 @@ +dialog[open].svelte-xyz{display:grid} \ No newline at end of file diff --git a/test/css/samples/attribute-selector-dialog-open/input.svelte b/test/css/samples/attribute-selector-dialog-open/input.svelte new file mode 100644 index 000000000000..d90211f1b219 --- /dev/null +++ b/test/css/samples/attribute-selector-dialog-open/input.svelte @@ -0,0 +1,7 @@ +Hello + +