Skip to content

Commit df93272

Browse files
authored
fix: deprecate axe.commons.utils namespace (#1330)
1 parent f53479b commit df93272

23 files changed

+62
-69
lines changed

build/tasks/langs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ module.exports = function(grunt) {
4343
'/**\n',
4444
' * Returns array of valid language codes\n',
4545
' * @method validLangs\n',
46-
' * @memberof axe.commons.utils\n',
46+
' * @memberof axe.utils\n',
4747
' * @instance\n',
4848
' * @return {Array<Sting>} Valid language codes\n',
4949
' */\n',

lib/checks/aria/required-children.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const requiredOwned = axe.commons.aria.requiredOwned;
22
const implicitNodes = axe.commons.aria.implicitNodes;
3-
const matchesSelector = axe.commons.utils.matchesSelector;
3+
const matchesSelector = axe.utils.matchesSelector;
44
const idrefs = axe.commons.dom.idrefs;
55
const reviewEmpty =
66
options && Array.isArray(options.reviewEmpty) ? options.reviewEmpty : [];

lib/checks/aria/required-parent.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ function getAriaOwners(element) {
4949

5050
while (element) {
5151
if (element.getAttribute('id')) {
52-
const id = axe.commons.utils.escapeSelector(element.getAttribute('id'));
52+
const id = axe.utils.escapeSelector(element.getAttribute('id'));
5353
let doc = axe.commons.dom.getRootNode(element);
5454
o = doc.querySelector(`[aria-owns~=${id}]`);
5555
if (o) {

lib/checks/forms/fieldset.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ var failureCode,
22
self = this;
33

44
function getUnrelatedElements(parent, name) {
5-
return axe.commons.utils.toArray(
5+
return axe.utils.toArray(
66
parent.querySelectorAll(
77
'select,textarea,button,input:not([name="' +
88
name +
@@ -58,17 +58,17 @@ function checkARIAGroup(group, name) {
5858
}
5959

6060
function spliceCurrentNode(nodes, current) {
61-
return axe.commons.utils.toArray(nodes).filter(function(candidate) {
61+
return axe.utils.toArray(nodes).filter(function(candidate) {
6262
return candidate !== current;
6363
});
6464
}
6565

6666
function runCheck(virtualNode) {
67-
const name = axe.commons.utils.escapeSelector(virtualNode.actualNode.name);
67+
const name = axe.utils.escapeSelector(virtualNode.actualNode.name);
6868
const root = axe.commons.dom.getRootNode(virtualNode.actualNode);
6969
const matchingNodes = root.querySelectorAll(
7070
'input[type="' +
71-
axe.commons.utils.escapeSelector(virtualNode.actualNode.type) +
71+
axe.utils.escapeSelector(virtualNode.actualNode.type) +
7272
'"][name="' +
7373
name +
7474
'"]'

lib/checks/forms/group-labelledby.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
const { dom, text, utils } = axe.commons;
1+
const { dom, text } = axe.commons;
22

3-
const type = utils.escapeSelector(node.type);
4-
const name = utils.escapeSelector(node.name);
3+
const type = axe.utils.escapeSelector(node.type);
4+
const name = axe.utils.escapeSelector(node.name);
55
const doc = dom.getRootNode(node);
66
const data = {
77
name: node.name,

lib/checks/label/explicit.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
if (node.getAttribute('id')) {
22
const root = axe.commons.dom.getRootNode(node);
3-
const id = axe.commons.utils.escapeSelector(node.getAttribute('id'));
3+
const id = axe.utils.escapeSelector(node.getAttribute('id'));
44
const label = root.querySelector(`label[for="${id}"]`);
55

66
if (label) {

lib/checks/label/hidden-explicit-label.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
if (node.getAttribute('id')) {
22
const root = axe.commons.dom.getRootNode(node);
3-
const id = axe.commons.utils.escapeSelector(node.getAttribute('id'));
3+
const id = axe.utils.escapeSelector(node.getAttribute('id'));
44
const label = root.querySelector(`label[for="${id}"]`);
55

66
if (label && !axe.commons.dom.isVisible(label, true)) {

lib/checks/label/multiple-label.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const id = axe.commons.utils.escapeSelector(node.getAttribute('id'));
1+
const id = axe.utils.escapeSelector(node.getAttribute('id'));
22
let labels = Array.from(document.querySelectorAll(`label[for="${id}"]`));
33
let parent = node.parentNode;
44

lib/checks/language/valid-lang.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
var langs, invalid;
22

3-
langs = (options ? options : axe.commons.utils.validLangs()).map(
4-
axe.commons.utils.getBaseLang
5-
);
3+
langs = (options ? options : axe.utils.validLangs()).map(axe.utils.getBaseLang);
64

75
invalid = ['lang', 'xml:lang'].reduce(function(invalid, langAttr) {
86
var langVal = node.getAttribute(langAttr);
97
if (typeof langVal !== 'string') {
108
return invalid;
119
}
1210

13-
var baselangVal = axe.commons.utils.getBaseLang(langVal);
11+
var baselangVal = axe.utils.getBaseLang(langVal);
1412

1513
// Edge sets lang to an empty string when xml:lang is set
1614
// so we need to ignore empty strings here

lib/checks/language/xml-lang-mismatch.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const { getBaseLang } = axe.commons.utils;
1+
const { getBaseLang } = axe.utils;
22
const primaryLangValue = getBaseLang(node.getAttribute('lang'));
33
const primaryXmlLangValue = getBaseLang(node.getAttribute('xml:lang'));
44

0 commit comments

Comments
 (0)