dequelabs / dequelabs/axe-core
Cache common element computations on vNode
- Dominant language
- JavaScript
- Stars
- 7.5k
- Forks
- 933
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 17
Description
There are a few node computations Axe-core does over and over again. Things like reading the accessible name, or the role. We should look at caching these on the virtual node to see if it helps with performance:
```js
class AbstractVirtualNode {
// Pseudo code
get role => memoize(this, getRole(this))
get roleType => memoize(this, getRoleType(this))
get implicitRole => memoize(this, getImplicitRole(this))
get explicitRole => memoize(this, getExplicitRole(this))
get accessibleText => memoize(this, accessibleTextVirtual(this))
vNode.aria => memoize([this, arg[0]], getAriaValue(this, 'aria-' + arg[0]).value)
vNode.ariaSource => memoize([this, arg[0]], getAriaValue(this, 'aria-' + arg[0]).source)
vNode.ref => memoize([this, arg[0]], getResolvedRef(this, arg[0]))
}
```
Contributor guide
Assessment
This issue has not been assessed yet.