diff --git a/src/compiler/compile/css/Selector.ts b/src/compiler/compile/css/Selector.ts
index 07e2dc439e..5c6a8e6d89 100644
--- a/src/compiler/compile/css/Selector.ts
+++ b/src/compiler/compile/css/Selector.ts
@@ -350,7 +350,7 @@ function attribute_matches(node: CssNode, name: string, expected_value: string,
const attr = node.attributes.find((attr: CssNode) => attr.name === name);
if (!attr) return false;
if (attr.is_true) return operator === null;
- if (!expected_value) return true;
+ if (expected_value === null) return true;
if (attr.chunks.length === 1) {
const value = attr.chunks[0];
diff --git a/test/css/samples/unused-selector-empty-attribute/_config.js b/test/css/samples/unused-selector-empty-attribute/_config.js
new file mode 100644
index 0000000000..6f77c6a3e1
--- /dev/null
+++ b/test/css/samples/unused-selector-empty-attribute/_config.js
@@ -0,0 +1,25 @@
+export default {
+ warnings: [{
+ filename: 'SvelteComponent.svelte',
+ code: 'css-unused-selector',
+ message: 'Unused CSS selector "img[alt=""]"',
+ start: {
+ character: 87,
+ column: 1,
+ line: 8
+ },
+ end: {
+ character: 98,
+ column: 12,
+ line: 8
+ },
+ pos: 87,
+ frame: `
+ 6: }
+ 7:
+ 8: img[alt=""] {
+ ^
+ 9: border: 1px solid red;
+ 10: }`
+ }]
+};
diff --git a/test/css/samples/unused-selector-empty-attribute/expected.css b/test/css/samples/unused-selector-empty-attribute/expected.css
new file mode 100644
index 0000000000..987fa142db
--- /dev/null
+++ b/test/css/samples/unused-selector-empty-attribute/expected.css
@@ -0,0 +1 @@
+img[alt].svelte-xyz{border:1px solid green}
\ No newline at end of file
diff --git a/test/css/samples/unused-selector-empty-attribute/expected.html b/test/css/samples/unused-selector-empty-attribute/expected.html
new file mode 100644
index 0000000000..889908c217
--- /dev/null
+++ b/test/css/samples/unused-selector-empty-attribute/expected.html
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/test/css/samples/unused-selector-empty-attribute/input.svelte b/test/css/samples/unused-selector-empty-attribute/input.svelte
new file mode 100644
index 0000000000..0200e537be
--- /dev/null
+++ b/test/css/samples/unused-selector-empty-attribute/input.svelte
@@ -0,0 +1,11 @@
+
+
+