axe-core 4.5.2 → 4.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/axe.d.ts +75 -24
- package/axe.js +4765 -4555
- package/axe.min.js +2 -2
- package/package.json +2 -2
- package/sri-history.json +4 -0
package/axe.d.ts
CHANGED
|
@@ -45,23 +45,65 @@ declare namespace axe {
|
|
|
45
45
|
| 'embedded'
|
|
46
46
|
| 'interactive';
|
|
47
47
|
|
|
48
|
+
// Array of length 2 or greater
|
|
49
|
+
type MultiArray<T> = [T, T, ...T[]];
|
|
50
|
+
|
|
51
|
+
// Selectors within a frame
|
|
48
52
|
type BaseSelector = string;
|
|
49
|
-
type CrossTreeSelector = BaseSelector | BaseSelector[];
|
|
50
|
-
type CrossFrameSelector = CrossTreeSelector[];
|
|
51
53
|
|
|
52
|
-
type
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
};
|
|
54
|
+
type ShadowDomSelector = MultiArray<BaseSelector>;
|
|
55
|
+
type CrossTreeSelector = BaseSelector | ShadowDomSelector;
|
|
56
|
+
type LabelledShadowDomSelector = { fromShadowDom: ShadowDomSelector };
|
|
56
57
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
};
|
|
58
|
+
// Cross-frame selectors
|
|
59
|
+
type FramesSelector = Array<CrossTreeSelector | LabelledShadowDomSelector>;
|
|
60
|
+
type UnlabelledFrameSelector = CrossTreeSelector[];
|
|
61
|
+
type LabelledFramesSelector = { fromFrames: MultiArray<FramesSelector[0]> };
|
|
62
|
+
/**
|
|
63
|
+
* @deprecated Use UnlabelledFrameSelector instead
|
|
64
|
+
*/
|
|
65
|
+
type CrossFrameSelector = UnlabelledFrameSelector;
|
|
66
|
+
|
|
67
|
+
// Context options
|
|
68
|
+
type Selector =
|
|
69
|
+
| Node
|
|
70
|
+
| BaseSelector
|
|
71
|
+
| LabelledShadowDomSelector
|
|
72
|
+
| LabelledFramesSelector;
|
|
73
|
+
type SelectorList = Array<Selector | FramesSelector> | NodeList;
|
|
74
|
+
type ContextObject =
|
|
75
|
+
| {
|
|
76
|
+
include: Selector | SelectorList;
|
|
77
|
+
exclude?: Selector | SelectorList;
|
|
78
|
+
}
|
|
79
|
+
| {
|
|
80
|
+
exclude: Selector | SelectorList;
|
|
81
|
+
};
|
|
82
|
+
type ElementContext = Selector | SelectorList | ContextObject;
|
|
61
83
|
|
|
62
|
-
type
|
|
84
|
+
type SerialSelector =
|
|
85
|
+
| BaseSelector
|
|
86
|
+
| LabelledShadowDomSelector
|
|
87
|
+
| LabelledFramesSelector;
|
|
88
|
+
type SerialFrameSelector = SerialSelector | FramesSelector;
|
|
89
|
+
type SerialSelectorList = Array<SerialFrameSelector>;
|
|
63
90
|
|
|
64
|
-
type
|
|
91
|
+
type SerialContextObject =
|
|
92
|
+
| {
|
|
93
|
+
include: SerialSelector | SerialSelectorList;
|
|
94
|
+
exclude?: SerialSelector | SerialSelectorList;
|
|
95
|
+
}
|
|
96
|
+
| {
|
|
97
|
+
exclude: SerialSelector | SerialSelectorList;
|
|
98
|
+
include?: SerialSelector | SerialSelectorList;
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
interface FrameContextObject {
|
|
102
|
+
include: UnlabelledFrameSelector[];
|
|
103
|
+
exclude: UnlabelledFrameSelector[];
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
type RunCallback<T = AxeResults> = (error: Error, results: T) => void;
|
|
65
107
|
|
|
66
108
|
interface TestEngine {
|
|
67
109
|
name: string;
|
|
@@ -255,9 +297,9 @@ declare namespace axe {
|
|
|
255
297
|
interface SerialDqElement {
|
|
256
298
|
source: string;
|
|
257
299
|
nodeIndexes: number[];
|
|
258
|
-
selector:
|
|
300
|
+
selector: UnlabelledFrameSelector;
|
|
259
301
|
xpath: string[];
|
|
260
|
-
ancestry:
|
|
302
|
+
ancestry: UnlabelledFrameSelector;
|
|
261
303
|
}
|
|
262
304
|
interface PartialRuleResult {
|
|
263
305
|
id: string;
|
|
@@ -274,7 +316,7 @@ declare namespace axe {
|
|
|
274
316
|
type PartialResults = Array<PartialResult | null>;
|
|
275
317
|
interface FrameContext {
|
|
276
318
|
frameSelector: CrossTreeSelector;
|
|
277
|
-
frameContext:
|
|
319
|
+
frameContext: FrameContextObject;
|
|
278
320
|
}
|
|
279
321
|
interface Utils {
|
|
280
322
|
getFrameContexts: (
|
|
@@ -282,6 +324,7 @@ declare namespace axe {
|
|
|
282
324
|
options?: RunOptions
|
|
283
325
|
) => FrameContext[];
|
|
284
326
|
shadowSelect: (selector: CrossTreeSelector) => Element | null;
|
|
327
|
+
shadowSelectAll: (selector: CrossTreeSelector) => Element[];
|
|
285
328
|
}
|
|
286
329
|
interface EnvironmentData {
|
|
287
330
|
testEngine: TestEngine;
|
|
@@ -313,19 +356,27 @@ declare namespace axe {
|
|
|
313
356
|
* @param {RunCallback} callback Optional The function to invoke when analysis is complete.
|
|
314
357
|
* @returns {Promise<AxeResults>|void} If the callback was not defined, axe will return a Promise.
|
|
315
358
|
*/
|
|
316
|
-
function run(context?: ElementContext): Promise<
|
|
317
|
-
function run(options: RunOptions): Promise<
|
|
318
|
-
function run
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
function run(
|
|
359
|
+
function run<T = AxeResults>(context?: ElementContext): Promise<T>;
|
|
360
|
+
function run<T = AxeResults>(options: RunOptions): Promise<T>;
|
|
361
|
+
function run<T = AxeResults>(
|
|
362
|
+
callback: (error: Error, results: T) => void
|
|
363
|
+
): void;
|
|
364
|
+
function run<T = AxeResults>(
|
|
365
|
+
context: ElementContext,
|
|
366
|
+
callback: RunCallback<T>
|
|
367
|
+
): void;
|
|
368
|
+
function run<T = AxeResults>(
|
|
369
|
+
options: RunOptions,
|
|
370
|
+
callback: RunCallback<T>
|
|
371
|
+
): void;
|
|
372
|
+
function run<T = AxeResults>(
|
|
322
373
|
context: ElementContext,
|
|
323
374
|
options: RunOptions
|
|
324
|
-
): Promise<
|
|
325
|
-
function run(
|
|
375
|
+
): Promise<T>;
|
|
376
|
+
function run<T = AxeResults>(
|
|
326
377
|
context: ElementContext,
|
|
327
378
|
options: RunOptions,
|
|
328
|
-
callback: RunCallback
|
|
379
|
+
callback: RunCallback<T>
|
|
329
380
|
): void;
|
|
330
381
|
|
|
331
382
|
/**
|