From 0324acbf9f93722f7fe4760e7279230347f9782c Mon Sep 17 00:00:00 2001 From: Steven Lambert Date: Wed, 17 Apr 2019 16:11:18 -0600 Subject: [PATCH] remove redundant idRefsCached --- lib/commons/aria/is-accessible-ref.js | 4 ++-- lib/core/public/run-rules.js | 4 +--- test/testutils.js | 9 +-------- 3 files changed, 4 insertions(+), 13 deletions(-) diff --git a/lib/commons/aria/is-accessible-ref.js b/lib/commons/aria/is-accessible-ref.js index 8c1e0a6765..62403760ea 100644 --- a/lib/commons/aria/is-accessible-ref.js +++ b/lib/commons/aria/is-accessible-ref.js @@ -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]; diff --git a/lib/core/public/run-rules.js b/lib/core/public/run-rules.js index 6004ae96ae..d740531371 100644 --- a/lib/core/public/run-rules.js +++ b/lib/core/public/run-rules.js @@ -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); diff --git a/test/testutils.js b/test/testutils.js index 29d6d7e304..6114340f3f 100644 --- a/test/testutils.js +++ b/test/testutils.js @@ -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); @@ -305,8 +300,6 @@ axe.testUtils = testUtils; beforeEach(function() { axe._cache = { - nodeMap: new WeakMap(), - idRefs: {}, - idRefsCached: false + nodeMap: new WeakMap() }; });