Skip to content

Commit 938b411

Browse files
authored
fix(utils/get-selector): ignore 'xmlns' attribute when generating a selector (#4303)
Ignore the "xmlns" attribute when generating a selector, since the selector spec does not support namespaces. Closes: #4302
1 parent f3569c5 commit 938b411

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

lib/core/utils/get-selector.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ const ignoredAttributes = [
2222
'aria-expanded',
2323
'aria-grabbed',
2424
'aria-pressed',
25-
'aria-valuenow'
25+
'aria-valuenow',
26+
'xmlns'
2627
];
2728
const MAXATTRIBUTELENGTH = 31;
2829
const attrCharsRegex = /([\\"])/g;

test/core/utils/get-selector.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,8 @@ describe('axe.utils.getSelector', function () {
471471
'aria-expanded',
472472
'aria-grabbed',
473473
'aria-pressed',
474-
'aria-valuenow'
474+
'aria-valuenow',
475+
'xmlns'
475476
];
476477
ignoredAttributes.forEach(function (att) {
477478
node.setAttribute(att, 'true');

0 commit comments

Comments
 (0)