Skip to content

:not selector doesn't work with class-directive #14169

@sockmaster27

Description

@sockmaster27

Describe the bug

For the following Svelte component I would expect that the h1 element would be styled with a red background:

<script>
	const x = false;
</script>

<h1 class:x>Hello, world!</h1>

<style>
	h1:not(.x) {
		background-color: red;
	}
</style>

Instead, no background color is applied to the element and a warning is produced:
Unused CSS selector "h1:not(.x)"

Reproduction

https://svelte.dev/playground/7e9220bafc094e209bb9a53e7e7bb48d?version=5.1.10

Logs

No response

System Info

N/A

Severity

annoyance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions