From d2de13de290339d9ba6df444d30fa23147314b03 Mon Sep 17 00:00:00 2001 From: Conduitry Date: Mon, 4 May 2020 11:15:26 -0400 Subject: [PATCH] fix handling of empty alt attributes --- src/compiler/compile/nodes/Element.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/compile/nodes/Element.ts b/src/compiler/compile/nodes/Element.ts index 5cda9919af..a337eff73a 100644 --- a/src/compiler/compile/nodes/Element.ts +++ b/src/compiler/compile/nodes/Element.ts @@ -488,7 +488,7 @@ export default class Element extends Node { if (alt_attribute && !aria_hidden_exist) { const alt_value = alt_attribute.get_static_value(); - if (alt_value && alt_value.match(/\b(image|picture|photo)\b/i)) { + if (/\b(image|picture|photo)\b/i.test(alt_value)) { component.warn(this, { code: `a11y-img-redundant-alt`, message: `A11y: Screenreaders already announce elements as an image.`