Skip to content

Commit 9ea3695

Browse files
committed
fix(#24): address round-2 Copilot review (case-insensitive attribute lookup in html-interactive-content)
1 parent 372b51e commit 9ea3695

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

lib/utils/html-interactive-content.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,16 @@ function isHtmlInteractiveContent(node, getTextAttrValue, options = {}) {
8888
}
8989

9090
function hasAttribute(node, name) {
91-
return Boolean(node.attributes && node.attributes.some((a) => a.name === name));
91+
if (typeof name !== 'string') {
92+
return false;
93+
}
94+
const normalizedName = name.toLowerCase();
95+
return Boolean(
96+
node.attributes &&
97+
node.attributes.some(
98+
(a) => typeof a.name === 'string' && a.name.toLowerCase() === normalizedName,
99+
),
100+
);
92101
}
93102

94103
module.exports = { isHtmlInteractiveContent };

0 commit comments

Comments
 (0)