Skip to content

Commit

Permalink
remove redundant idRefsCached
Browse files Browse the repository at this point in the history
  • Loading branch information
straker committed Apr 17, 2019
1 parent a50b91e commit 0324acb
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 13 deletions.
4 changes: 2 additions & 2 deletions lib/commons/aria/is-accessible-ref.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ aria.isAccessibleRef = function isAccessibleRef(node) {

// because axe.commons is not available in axe.utils, we can't do
// this caching when we build up the virtual tree
if (!axe._cache.idRefsCached) {
axe._cache.idRefsCached = true;
if (!axe._cache.idRefs) {
axe._cache.idRefs = {};
// Get all idref(s) attributes on the lookup table
const refAttrs = Object.keys(aria.lookupTable.attributes).filter(attr => {
const { type } = aria.lookupTable.attributes[attr];
Expand Down
4 changes: 1 addition & 3 deletions lib/core/public/run-rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ function runRules(context, options, resolve, reject) {
'use strict';
try {
axe._cache = {
nodeMap: new WeakMap(),
idRefs: {},
idRefsCached: false
nodeMap: new WeakMap()
};

context = new Context(context);
Expand Down
9 changes: 1 addition & 8 deletions test/testutils.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,6 @@ testUtils.fixtureSetup = function(content) {
fixture.appendChild(node);
});
}
axe._cache = {
nodeMap: new WeakMap(),
idRefs: {},
idRefsCached: false
};
axe._tree = axe.utils.getFlattenedTree(fixture);
axe._selectorData = axe.utils.getSelectorData(axe._tree);

Expand Down Expand Up @@ -305,8 +300,6 @@ axe.testUtils = testUtils;

beforeEach(function() {
axe._cache = {
nodeMap: new WeakMap(),
idRefs: {},
idRefsCached: false
nodeMap: new WeakMap()
};
});

0 comments on commit 0324acb

Please sign in to comment.