From a068719208e4ca56c7e287e350916ff604770e63 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 d9868f45306..5123f6fec43 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 00000000000..54d85c4ee8f --- /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 00000000000..d90211f1b21 --- /dev/null +++ b/test/css/samples/attribute-selector-dialog-open/input.svelte @@ -0,0 +1,7 @@ +Hello + +