Skip to content

Commit

Permalink
just cast the node to Text
Browse files Browse the repository at this point in the history
  • Loading branch information
koddsson committed Jun 14, 2024
1 parent 5f1be8e commit 1a2d92d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/rules/valid-lang.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ export default function (el: Element): AccessibilityError[] {
for (const element of elements) {
const firstTextNode = document
.createNodeIterator(element, NodeFilter.SHOW_TEXT, (node) => {
if (node.wholeText.trim() === "") return NodeFilter.FILTER_REJECT;
if ((node as Text).wholeText.trim() === "")
return NodeFilter.FILTER_REJECT;
const parentElement = node.parentElement;
const closestLangElement = parentElement?.closest("[lang]");
return closestLangElement?.isSameNode(element)
Expand Down

0 comments on commit 1a2d92d

Please sign in to comment.