Skip to content

Commit

Permalink
Update image-has-alt.js
Browse files Browse the repository at this point in the history
  • Loading branch information
dutscher authored Jun 26, 2024
1 parent 0c95dec commit fa4878c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lib/helpers/a11y-rules/image-has-alt.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ export default {
isActive: false,
test: (dom) => {
let nodes = Array.from(dom?.querySelectorAll("img"));
let nodesWithoutAlt = nodes.filter((img) => img.getAttribute("alt") === undefined);
let nodesWithoutAlt = nodes.filter((img) => img.getAttribute("alt") === (undefined || ''));

console.debug('nodes:', nodes);
console.debug('nodesWithoutAlt:', nodesWithoutAlt);

return nodesWithoutAlt.length === 0;
}
}
}

0 comments on commit fa4878c

Please sign in to comment.