From 8c6854661f4613d0b7a6ba98bbfdc0c9ca61b4d1 Mon Sep 17 00:00:00 2001 From: Trevor Huey Date: Thu, 18 Jan 2024 08:53:19 -0600 Subject: [PATCH] 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: https://github.com/dequelabs/axe-core/issues/4302 --- lib/core/utils/get-selector.js | 3 ++- test/core/utils/get-selector.js | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/core/utils/get-selector.js b/lib/core/utils/get-selector.js index 28af5bf6af..a90d3c1528 100644 --- a/lib/core/utils/get-selector.js +++ b/lib/core/utils/get-selector.js @@ -22,7 +22,8 @@ const ignoredAttributes = [ 'aria-expanded', 'aria-grabbed', 'aria-pressed', - 'aria-valuenow' + 'aria-valuenow', + 'xmlns' ]; const MAXATTRIBUTELENGTH = 31; const attrCharsRegex = /([\\"])/g; diff --git a/test/core/utils/get-selector.js b/test/core/utils/get-selector.js index 520bfbea56..0a2cab5b78 100644 --- a/test/core/utils/get-selector.js +++ b/test/core/utils/get-selector.js @@ -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');