Skip to content

Commit d3c8b4b

Browse files
authored
Merge pull request #4277 from dequelabs/release-4.8.3
chore(release): 4.8.3
2 parents 9968aa9 + be789dc commit d3c8b4b

10 files changed

+134
-114
lines changed

.eslintrc.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,10 @@ module.exports = {
109109
},
110110
{
111111
// polyfills are mostly copy-pasted from sources so we don't control their styling
112-
files: ['lib/core/utils/pollyfills.js'],
112+
files: [
113+
'lib/core/imports/polyfills.js',
114+
'lib/core/utils/pollyfill-elements-from-point.js'
115+
],
113116
env: {
114117
browser: false
115118
},

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
44

5+
### [4.8.3](https://github.com/dequelabs/axe-core/compare/v4.8.2...v4.8.3) (2023-12-18)
6+
7+
### Bug Fixes
8+
9+
- add Object.values polyfill for node <=6 ([#4274](https://github.com/dequelabs/axe-core/issues/4274)) ([b39b0e6](https://github.com/dequelabs/axe-core/commit/b39b0e60b68f8c1e34dc056809a04f8ccf8f24c7))
10+
511
### [4.8.2](https://github.com/dequelabs/axe-core/compare/v4.8.1...v4.8.2) (2023-09-18)
612

713
### Bug Fixes

bower.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "axe-core",
3-
"version": "4.8.2",
3+
"version": "4.8.3",
44
"deprecated": true,
55
"contributors": [
66
{

lib/core/imports/index.js

+3-32
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,16 @@
1+
import './polyfills';
2+
3+
// some of these imports require polyfills to be loaded first
14
import { CssSelectorParser } from 'css-selector-parser';
25
import doT from '@deque/dot';
36
import emojiRegexText from 'emoji-regex';
47
import memoize from 'memoizee';
58
import Color from 'colorjs.io';
69

7-
import es6promise from 'es6-promise';
8-
import { Uint32Array } from 'typedarray';
9-
import 'weakmap-polyfill';
10-
import hasOwn from 'core-js-pure/actual/object/has-own';
11-
12-
if (!('hasOwn' in Object)) {
13-
Object.hasOwn = hasOwn;
14-
}
15-
1610
// prevent striping newline characters from strings (e.g. failure
1711
// summaries). value must be synced with build/configure.js
1812
doT.templateSettings.strip = false;
1913

20-
if (!('Promise' in window)) {
21-
es6promise.polyfill();
22-
}
23-
24-
if (!('Uint32Array' in window)) {
25-
window.Uint32Array = Uint32Array;
26-
}
27-
if (window.Uint32Array) {
28-
// @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/some
29-
if (!('some' in window.Uint32Array.prototype)) {
30-
Object.defineProperty(window.Uint32Array.prototype, 'some', {
31-
value: Array.prototype.some
32-
});
33-
}
34-
35-
if (!('reduce' in window.Uint32Array.prototype)) {
36-
// @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/reduce
37-
Object.defineProperty(window.Uint32Array.prototype, 'reduce', {
38-
value: Array.prototype.reduce
39-
});
40-
}
41-
}
42-
4314
/**
4415
* Namespace `axe.imports` which holds required external dependencies
4516
*

lib/core/utils/pollyfills.js lib/core/imports/polyfills.js

+39-76
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,45 @@
1+
import es6promise from 'es6-promise';
2+
import { Uint32Array } from 'typedarray';
3+
import 'weakmap-polyfill';
4+
import hasOwn from 'core-js-pure/actual/object/has-own';
5+
import values from 'core-js-pure/actual/object/values';
6+
7+
if (!('hasOwn' in Object)) {
8+
Object.hasOwn = hasOwn;
9+
}
10+
11+
if (!('values' in Object)) {
12+
Object.values = values;
13+
}
14+
15+
if (!('Promise' in window)) {
16+
es6promise.polyfill();
17+
}
18+
19+
if (!('Uint32Array' in window)) {
20+
window.Uint32Array = Uint32Array;
21+
}
22+
if (window.Uint32Array) {
23+
// @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/some
24+
if (!('some' in window.Uint32Array.prototype)) {
25+
Object.defineProperty(window.Uint32Array.prototype, 'some', {
26+
value: Array.prototype.some
27+
});
28+
}
29+
30+
if (!('reduce' in window.Uint32Array.prototype)) {
31+
// @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/reduce
32+
Object.defineProperty(window.Uint32Array.prototype, 'reduce', {
33+
value: Array.prototype.reduce
34+
});
35+
}
36+
}
37+
138
/*
239
These polyfills came directly from the ES Specification itself
340
Contained within:
4-
- Object.assign
5-
- Array.prototype.find
41+
- Object.assign
42+
- Array.prototype.find
643
*/
744
if (typeof Object.assign !== 'function') {
845
(function () {
@@ -76,80 +113,6 @@ if (!Array.prototype.findIndex) {
76113
});
77114
}
78115

79-
// Spelled incorrectly intentionally (backwards compatibility).
80-
export function pollyfillElementsFromPoint() {
81-
if (document.elementsFromPoint) return document.elementsFromPoint;
82-
if (document.msElementsFromPoint) return document.msElementsFromPoint;
83-
84-
var usePointer = (function () {
85-
var element = document.createElement('x');
86-
element.style.cssText = 'pointer-events:auto';
87-
return element.style.pointerEvents === 'auto';
88-
})();
89-
90-
var cssProp = usePointer ? 'pointer-events' : 'visibility';
91-
var cssDisableVal = usePointer ? 'none' : 'hidden';
92-
93-
var style = document.createElement('style');
94-
style.innerHTML = usePointer
95-
? '* { pointer-events: all }'
96-
: '* { visibility: visible }';
97-
98-
return function (x, y) {
99-
var current, i, d;
100-
var elements = [];
101-
var previousPointerEvents = [];
102-
103-
// startup
104-
document.head.appendChild(style);
105-
106-
while (
107-
(current = document.elementFromPoint(x, y)) &&
108-
elements.indexOf(current) === -1
109-
) {
110-
// push the element and its current style
111-
elements.push(current);
112-
113-
previousPointerEvents.push({
114-
value: current.style.getPropertyValue(cssProp),
115-
priority: current.style.getPropertyPriority(cssProp)
116-
});
117-
118-
// add "pointer-events: none", to get to the underlying element
119-
current.style.setProperty(cssProp, cssDisableVal, 'important');
120-
}
121-
122-
// Due to negative index, documentElement could actually not be the last,
123-
// so we'll simply move it to the end
124-
if (elements.indexOf(document.documentElement) < elements.length - 1) {
125-
elements.splice(elements.indexOf(document.documentElement), 1);
126-
elements.push(document.documentElement);
127-
}
128-
129-
// restore the previous pointer-events values
130-
for (
131-
i = previousPointerEvents.length;
132-
!!(d = previousPointerEvents[--i]);
133-
134-
) {
135-
elements[i].style.setProperty(
136-
cssProp,
137-
d.value ? d.value : '',
138-
d.priority
139-
);
140-
}
141-
142-
// teardown;
143-
document.head.removeChild(style);
144-
145-
return elements;
146-
};
147-
}
148-
149-
if (typeof window.addEventListener === 'function') {
150-
document.elementsFromPoint = pollyfillElementsFromPoint();
151-
}
152-
153116
if (!Array.prototype.includes) {
154117
Object.defineProperty(Array.prototype, 'includes', {
155118
value: function (searchElement) {

lib/core/utils/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export { default as parseCrossOriginStylesheet } from './parse-crossorigin-style
6363
export { default as parseSameOriginStylesheet } from './parse-sameorigin-stylesheet';
6464
export { default as parseStylesheet } from './parse-stylesheet';
6565
export { default as performanceTimer } from './performance-timer';
66-
export { pollyfillElementsFromPoint } from './pollyfills';
66+
export { pollyfillElementsFromPoint } from './pollyfill-elements-from-point';
6767
export { default as preloadCssom } from './preload-cssom';
6868
export { default as preloadMedia } from './preload-media';
6969
export { default as preload, shouldPreload, getPreloadConfig } from './preload';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
// Spelled incorrectly intentionally (backwards compatibility).
2+
export function pollyfillElementsFromPoint() {
3+
if (document.elementsFromPoint) return document.elementsFromPoint;
4+
if (document.msElementsFromPoint) return document.msElementsFromPoint;
5+
6+
var usePointer = (function () {
7+
var element = document.createElement('x');
8+
element.style.cssText = 'pointer-events:auto';
9+
return element.style.pointerEvents === 'auto';
10+
})();
11+
12+
var cssProp = usePointer ? 'pointer-events' : 'visibility';
13+
var cssDisableVal = usePointer ? 'none' : 'hidden';
14+
15+
var style = document.createElement('style');
16+
style.innerHTML = usePointer
17+
? '* { pointer-events: all }'
18+
: '* { visibility: visible }';
19+
20+
return function (x, y) {
21+
var current, i, d;
22+
var elements = [];
23+
var previousPointerEvents = [];
24+
25+
// startup
26+
document.head.appendChild(style);
27+
28+
while (
29+
(current = document.elementFromPoint(x, y)) &&
30+
elements.indexOf(current) === -1
31+
) {
32+
// push the element and its current style
33+
elements.push(current);
34+
35+
previousPointerEvents.push({
36+
value: current.style.getPropertyValue(cssProp),
37+
priority: current.style.getPropertyPriority(cssProp)
38+
});
39+
40+
// add "pointer-events: none", to get to the underlying element
41+
current.style.setProperty(cssProp, cssDisableVal, 'important');
42+
}
43+
44+
// Due to negative index, documentElement could actually not be the last,
45+
// so we'll simply move it to the end
46+
if (elements.indexOf(document.documentElement) < elements.length - 1) {
47+
elements.splice(elements.indexOf(document.documentElement), 1);
48+
elements.push(document.documentElement);
49+
}
50+
51+
// restore the previous pointer-events values
52+
for (
53+
i = previousPointerEvents.length;
54+
!!(d = previousPointerEvents[--i]);
55+
56+
) {
57+
elements[i].style.setProperty(
58+
cssProp,
59+
d.value ? d.value : '',
60+
d.priority
61+
);
62+
}
63+
64+
// teardown;
65+
document.head.removeChild(style);
66+
67+
return elements;
68+
};
69+
}
70+
71+
if (typeof window.addEventListener === 'function') {
72+
document.elementsFromPoint = pollyfillElementsFromPoint();
73+
}

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "axe-core",
33
"description": "Accessibility engine for automated Web UI testing",
4-
"version": "4.8.2",
4+
"version": "4.8.3",
55
"license": "MPL-2.0",
66
"engines": {
77
"node": ">=4"

sri-history.json

+4
Original file line numberDiff line numberDiff line change
@@ -362,5 +362,9 @@
362362
"4.8.2": {
363363
"axe.js": "sha256-VZuuruUDDRwfzCo4ZDDzXiVefuy4pSW6BlGx+D/ucC0=",
364364
"axe.min.js": "sha256-O9U055OcfxyKV61g3Qn7N9mvpJNht0RCPcFw+QjWTG4="
365+
},
366+
"4.8.3": {
367+
"axe.js": "sha256-YWpAAdIo7fwKmLq8nJx1f6pwt7HAXwWm15RSGJKbxhw=",
368+
"axe.min.js": "sha256-/mct+I/4SJnZ30Ce+j9T7ll9zPwzbJVrjdKpbKIP+NA="
365369
}
366370
}

0 commit comments

Comments
 (0)