File tree Expand file tree Collapse file tree 3 files changed +6
-1
lines changed
src/compiler/compile/nodes
test/validator/samples/a11y-img-redundant-alt Expand file tree Collapse file tree 3 files changed +6
-1
lines changed Original file line number Diff line number Diff line change 11# Svelte changelog
22
3+ ## Unreleased
4+
5+ * Fix compiler exception with ` a11y-img-redundant-alt ` and value-less ` alt ` attribute ([ #4777 ] ( https://github.com/sveltejs/svelte/issues/4777 ) )
6+
37## 3.22.1
48
59* Fix compiler exception with ` a11y-img-redundant-alt ` and dynamic ` alt ` attribute ([ #4770 ] ( https://github.com/sveltejs/svelte/issues/4770 ) )
Original file line number Diff line number Diff line change @@ -488,7 +488,7 @@ export default class Element extends Node {
488488 if ( alt_attribute && ! aria_hidden_exist ) {
489489 const alt_value = alt_attribute . get_static_value ( ) ;
490490
491- if ( alt_value && alt_value . match ( / \b ( i m a g e | p i c t u r e | p h o t o ) \b / i) ) {
491+ if ( / \b ( i m a g e | p i c t u r e | p h o t o ) \b / i. test ( alt_value ) ) {
492492 component . warn ( this , {
493493 code : `a11y-img-redundant-alt` ,
494494 message : `A11y: Screenreaders already announce <img> elements as an image.`
Original file line number Diff line number Diff line change 66<img src =" bar" alt =" Plant doing photosynthesis in the afternoon" />
77<img src =" foo" alt =" Picturesque food" />
88<img src ="baz" alt ={' baz' } />
9+ <img src =" baz" alt />
You can’t perform that action at this time.
0 commit comments