Skip to content

Commit

Permalink
fix(utils/get-selector): ignore 'xmlns' attribute when generating a s…
Browse files Browse the repository at this point in the history
…elector (#4303)

Ignore the "xmlns" attribute when generating a selector, since the
selector spec does not support namespaces.

Closes: #4302
  • Loading branch information
thuey authored and straker committed Feb 7, 2024
1 parent a2a6935 commit 8c68546
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/core/utils/get-selector.js
Expand Up @@ -22,7 +22,8 @@ const ignoredAttributes = [
'aria-expanded',
'aria-grabbed',
'aria-pressed',
'aria-valuenow'
'aria-valuenow',
'xmlns'
];
const MAXATTRIBUTELENGTH = 31;
const attrCharsRegex = /([\\"])/g;
Expand Down
3 changes: 2 additions & 1 deletion test/core/utils/get-selector.js
Expand Up @@ -471,7 +471,8 @@ describe('axe.utils.getSelector', function () {
'aria-expanded',
'aria-grabbed',
'aria-pressed',
'aria-valuenow'
'aria-valuenow',
'xmlns'
];
ignoredAttributes.forEach(function (att) {
node.setAttribute(att, 'true');
Expand Down

0 comments on commit 8c68546

Please sign in to comment.