From de5b1a1498709107e8f04830269e9a10cdde4906 Mon Sep 17 00:00:00 2001 From: thollander Date: Sun, 21 Mar 2021 14:42:30 +0100 Subject: [PATCH 1/3] fix(a11y): do not warn if href value is dynamic Closes #5990 --- src/compiler/compile/nodes/Attribute.ts | 2 +- test/validator/samples/a11y-anchor-has-content/input.svelte | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/compiler/compile/nodes/Attribute.ts b/src/compiler/compile/nodes/Attribute.ts index 47efc4b03661..23b5e54f3f17 100644 --- a/src/compiler/compile/nodes/Attribute.ts +++ b/src/compiler/compile/nodes/Attribute.ts @@ -96,7 +96,7 @@ export default class Attribute extends Node { } get_static_value() { - if (this.is_spread || this.dependencies.size > 0) return null; + if (this.is_spread || !this.is_static) return null; return this.is_true ? true diff --git a/test/validator/samples/a11y-anchor-has-content/input.svelte b/test/validator/samples/a11y-anchor-has-content/input.svelte index ca81f90ae895..74fd67a7f72a 100644 --- a/test/validator/samples/a11y-anchor-has-content/input.svelte +++ b/test/validator/samples/a11y-anchor-has-content/input.svelte @@ -1 +1,2 @@ - \ No newline at end of file + +hello From 0fd2397afdd0824b68a2fd65545e0751ca640ff7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?T=C3=A9rence=20Hollander?= Date: Sun, 21 Mar 2021 16:03:12 +0100 Subject: [PATCH 2/3] Update src/compiler/compile/nodes/Attribute.ts --- src/compiler/compile/nodes/Attribute.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/compile/nodes/Attribute.ts b/src/compiler/compile/nodes/Attribute.ts index 23b5e54f3f17..ebed483288a6 100644 --- a/src/compiler/compile/nodes/Attribute.ts +++ b/src/compiler/compile/nodes/Attribute.ts @@ -96,7 +96,7 @@ export default class Attribute extends Node { } get_static_value() { - if (this.is_spread || !this.is_static) return null; + if (!this.is_static) return null; return this.is_true ? true From c423eb54edc2588e6b7d79896998e625cd56dd96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?T=C3=A9rence=20Hollander?= Date: Sun, 21 Mar 2021 16:09:24 +0100 Subject: [PATCH 3/3] Update test/validator/samples/a11y-anchor-has-content/input.svelte --- test/validator/samples/a11y-anchor-has-content/input.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/validator/samples/a11y-anchor-has-content/input.svelte b/test/validator/samples/a11y-anchor-has-content/input.svelte index 74fd67a7f72a..e246a1e59351 100644 --- a/test/validator/samples/a11y-anchor-has-content/input.svelte +++ b/test/validator/samples/a11y-anchor-has-content/input.svelte @@ -1,2 +1,2 @@ -hello +bar