Skip to content

Commit

Permalink
Merge branch 'develop' into colorjs-patch
Browse files Browse the repository at this point in the history
  • Loading branch information
gaiety-deque authored May 28, 2024
2 parents 3ae8d35 + 6699ee4 commit 9c255b1
Show file tree
Hide file tree
Showing 4 changed files with 145 additions and 125 deletions.
4 changes: 4 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ updates:
# @see https://github.com/dequelabs/axe-core/issues/3771
- dependency-name: 'esbuild'
versions: ['>=0.11.0']
# Prevent colorjs.io issue caused by >v0.4.3
# @see https://github.com/dequelabs/axe-core/issues/4428
- dependency-name: 'colorjs.io'
versions: ['>0.4.3']
groups:
# Any updates not caught by the group config will get individual PRs
npm-low-risk:
Expand Down
10 changes: 8 additions & 2 deletions lib/core/utils/dq-element.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import getXpath from './get-xpath';
import getNodeFromTree from './get-node-from-tree';
import AbstractVirtualNode from '../base/virtual-node/abstract-virtual-node';
import cache from '../base/cache';
import memoize from './memoize';

const CACHE_KEY = 'DqElm.RunOptions';

Expand Down Expand Up @@ -36,7 +37,10 @@ function getSource(element) {
* @param {Object} options Propagated from axe.run/etc
* @param {Object} spec Properties to use in place of the element when instantiated on Elements from other frames
*/
function DqElement(elm, options = null, spec = {}) {
const DqElement = memoize(function DqElement(elm, options, spec) {
options ??= null;
spec ??= {};

if (!options) {
options = cache.get(CACHE_KEY) ?? {};
}
Expand Down Expand Up @@ -82,7 +86,9 @@ function DqElement(elm, options = null, spec = {}) {
if (!axe._audit.noHtml) {
this.source = this.spec.source ?? getSource(this._element);
}
}

return this;
});

DqElement.prototype = {
/**
Expand Down
Loading

0 comments on commit 9c255b1

Please sign in to comment.