@axe-core/watcher 4.3.0-next.f0210d95 → 4.3.0-next.f0cae6cb
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/extension/axe-versions/axe-core@4.12.1/axe.min.js +12 -0
- package/extension/axe-versions/axe-core@4.12.1/gather-internals.js +219 -0
- package/extension/axe-versions/axe-core@4.12.1/locales/README.md +9 -0
- package/extension/axe-versions/axe-core@4.12.1/locales/_template.json +1147 -0
- package/extension/axe-versions/axe-core@4.12.1/locales/da.json +799 -0
- package/extension/axe-versions/axe-core@4.12.1/locales/de.json +1127 -0
- package/extension/axe-versions/axe-core@4.12.1/locales/el.json +1069 -0
- package/extension/axe-versions/axe-core@4.12.1/locales/es.json +790 -0
- package/extension/axe-versions/axe-core@4.12.1/locales/eu.json +789 -0
- package/extension/axe-versions/axe-core@4.12.1/locales/fr.json +994 -0
- package/extension/axe-versions/axe-core@4.12.1/locales/he.json +1017 -0
- package/extension/axe-versions/axe-core@4.12.1/locales/it.json +1108 -0
- package/extension/axe-versions/axe-core@4.12.1/locales/ja.json +1128 -0
- package/extension/axe-versions/axe-core@4.12.1/locales/ko.json +1003 -0
- package/extension/axe-versions/axe-core@4.12.1/locales/nb.json +799 -0
- package/extension/axe-versions/axe-core@4.12.1/locales/nl.json +48 -0
- package/extension/axe-versions/axe-core@4.12.1/locales/pl.json +1109 -0
- package/extension/axe-versions/axe-core@4.12.1/locales/pt_BR.json +970 -0
- package/extension/axe-versions/axe-core@4.12.1/locales/pt_PT.json +1123 -0
- package/extension/axe-versions/axe-core@4.12.1/locales/ru.json +1127 -0
- package/extension/axe-versions/axe-core@4.12.1/locales/zh_CN.json +1116 -0
- package/extension/axe-versions/axe-core@4.12.1/locales/zh_TW.json +1108 -0
- package/extension/axe-versions-mapper.js +2 -1
- package/extension/axe.js +1 -1
- package/extension/axe.js.LICENSE.txt +1 -1
- package/extension/background.js +1 -1
- package/extension/content.js +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
(() => {
|
|
2
|
+
var elementInternalsMap = (() => {
|
|
3
|
+
var __commonJS = (cb, mod) => () => (mod || cb((mod = {exports: {}}).exports, mod), mod.exports);
|
|
4
|
+
|
|
5
|
+
// lib/gather-internals/main.js
|
|
6
|
+
var require_main = __commonJS((exports, module) => {
|
|
7
|
+
walkTree();
|
|
8
|
+
module.exports = elementInternalsMap;
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
// lib/core/utils/is-valid-custom-element-name.js
|
|
12
|
+
var reservedNames = [
|
|
13
|
+
"annotation-xml",
|
|
14
|
+
"color-profile",
|
|
15
|
+
"font-face",
|
|
16
|
+
"font-face-src",
|
|
17
|
+
"font-face-uri",
|
|
18
|
+
"font-face-format",
|
|
19
|
+
"font-face-name",
|
|
20
|
+
"missing-glyph"
|
|
21
|
+
];
|
|
22
|
+
var validLocalNameRegex = /^(?:[A-Za-z][^\0\t\n\f\r\u0020/>]*|[:_\u0080-\u{10FFFF}][A-Za-z0-9-.:_\u0080-\u{10FFFF}]*)$/u;
|
|
23
|
+
var alphaLowerRegex = /[a-z]/;
|
|
24
|
+
var alphaUpperRegex = /[A-Z]/;
|
|
25
|
+
function isValidCustomElementName(nodeName) {
|
|
26
|
+
return !reservedNames.includes(nodeName) && validLocalNameRegex.test(nodeName) && alphaLowerRegex.test(nodeName[0]) && !alphaUpperRegex.test(nodeName) && nodeName.includes("-");
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// lib/core/utils/get-element-internals.js
|
|
30
|
+
var propNames = ["_internals", "internals", "internals_"];
|
|
31
|
+
var symbolNames = ["internals", "privateInternals"];
|
|
32
|
+
function getElementInternals(node) {
|
|
33
|
+
if (!isValidCustomElementName(node.nodeName.toLowerCase())) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const mapInternals = globalThis._elementInternals?.get(node);
|
|
37
|
+
if (mapInternals) {
|
|
38
|
+
return mapInternals;
|
|
39
|
+
}
|
|
40
|
+
if (!("ElementInternals" in window)) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
for (const propName of propNames) {
|
|
44
|
+
if (Object.getOwnPropertyDescriptor(node, propName)?.get) {
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
if (node[propName] instanceof window.ElementInternals) {
|
|
48
|
+
return node[propName];
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
const ownSymbols = Object.getOwnPropertySymbols(node);
|
|
52
|
+
if (!ownSymbols.length) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
for (const symbolName of symbolNames) {
|
|
56
|
+
const symbol = ownSymbols.find((s) => s.description === symbolName);
|
|
57
|
+
if (symbol) {
|
|
58
|
+
if (Object.getOwnPropertyDescriptor(node, symbol)?.get) {
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
if (node[symbol] instanceof window.ElementInternals) {
|
|
62
|
+
return node[symbol];
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// lib/core/utils/escape-selector.js
|
|
69
|
+
function escapeSelector(value) {
|
|
70
|
+
const string = String(value);
|
|
71
|
+
const length = string.length;
|
|
72
|
+
let index = -1;
|
|
73
|
+
let codeUnit;
|
|
74
|
+
let result = "";
|
|
75
|
+
const firstCodeUnit = string.charCodeAt(0);
|
|
76
|
+
while (++index < length) {
|
|
77
|
+
codeUnit = string.charCodeAt(index);
|
|
78
|
+
if (codeUnit == 0) {
|
|
79
|
+
result += "\uFFFD";
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
if (codeUnit >= 1 && codeUnit <= 31 || codeUnit == 127 || index == 0 && codeUnit >= 48 && codeUnit <= 57 || index == 1 && codeUnit >= 48 && codeUnit <= 57 && firstCodeUnit == 45) {
|
|
83
|
+
result += "\\" + codeUnit.toString(16) + " ";
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
if (index == 0 && length == 1 && codeUnit == 45) {
|
|
87
|
+
result += "\\" + string.charAt(index);
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
if (codeUnit >= 128 || codeUnit == 45 || codeUnit == 95 || codeUnit >= 48 && codeUnit <= 57 || codeUnit >= 65 && codeUnit <= 90 || codeUnit >= 97 && codeUnit <= 122) {
|
|
91
|
+
result += string.charAt(index);
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
result += "\\" + string.charAt(index);
|
|
95
|
+
}
|
|
96
|
+
return result;
|
|
97
|
+
}
|
|
98
|
+
var escape_selector_default = escapeSelector;
|
|
99
|
+
|
|
100
|
+
// lib/core/utils/get-shadow-selector.js
|
|
101
|
+
function getShadowSelector(generateSelector, elm, options = {}) {
|
|
102
|
+
if (!elm) {
|
|
103
|
+
return "";
|
|
104
|
+
}
|
|
105
|
+
let doc = elm.getRootNode && elm.getRootNode() || document;
|
|
106
|
+
if (doc.nodeType !== 11) {
|
|
107
|
+
return generateSelector(elm, options, doc);
|
|
108
|
+
}
|
|
109
|
+
const stack = [];
|
|
110
|
+
while (doc.nodeType === 11) {
|
|
111
|
+
if (!doc.host) {
|
|
112
|
+
return "";
|
|
113
|
+
}
|
|
114
|
+
stack.unshift({elm, doc});
|
|
115
|
+
elm = doc.host;
|
|
116
|
+
doc = elm.getRootNode();
|
|
117
|
+
}
|
|
118
|
+
stack.unshift({elm, doc});
|
|
119
|
+
return stack.map((item) => generateSelector(item.elm, options, item.doc));
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// lib/core/utils/get-ancestry.js
|
|
123
|
+
function generateAncestry(node) {
|
|
124
|
+
const nodeName = escape_selector_default(node.nodeName.toLowerCase());
|
|
125
|
+
const parentElement = node.parentElement;
|
|
126
|
+
const parentNode = node.parentNode;
|
|
127
|
+
let nthChild = "";
|
|
128
|
+
if (nodeName !== "head" && nodeName !== "body" && parentNode?.children.length > 1) {
|
|
129
|
+
const index = Array.prototype.indexOf.call(parentNode.children, node) + 1;
|
|
130
|
+
nthChild = `:nth-child(${index})`;
|
|
131
|
+
}
|
|
132
|
+
if (!parentElement) {
|
|
133
|
+
return nodeName + nthChild;
|
|
134
|
+
}
|
|
135
|
+
return generateAncestry(parentElement) + " > " + nodeName + nthChild;
|
|
136
|
+
}
|
|
137
|
+
function getAncestry(elm, options) {
|
|
138
|
+
return getShadowSelector(generateAncestry, elm, options);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// lib/core/utils/is-shadow-root.js
|
|
142
|
+
var possibleShadowRoots = [
|
|
143
|
+
"article",
|
|
144
|
+
"aside",
|
|
145
|
+
"blockquote",
|
|
146
|
+
"body",
|
|
147
|
+
"div",
|
|
148
|
+
"footer",
|
|
149
|
+
"h1",
|
|
150
|
+
"h2",
|
|
151
|
+
"h3",
|
|
152
|
+
"h4",
|
|
153
|
+
"h5",
|
|
154
|
+
"h6",
|
|
155
|
+
"header",
|
|
156
|
+
"main",
|
|
157
|
+
"nav",
|
|
158
|
+
"p",
|
|
159
|
+
"section",
|
|
160
|
+
"span"
|
|
161
|
+
];
|
|
162
|
+
function isShadowRoot(node) {
|
|
163
|
+
if (node.shadowRoot) {
|
|
164
|
+
const nodeName = node.nodeName.toLowerCase();
|
|
165
|
+
if (possibleShadowRoots.includes(nodeName) || isValidCustomElementName(nodeName)) {
|
|
166
|
+
return true;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
return false;
|
|
170
|
+
}
|
|
171
|
+
var is_shadow_root_default = isShadowRoot;
|
|
172
|
+
|
|
173
|
+
// lib/gather-internals/walk-tree.js
|
|
174
|
+
var elementInternalsMap = [];
|
|
175
|
+
var ariaPropRegex = /^aria[A-Z]/;
|
|
176
|
+
var propsToCapture = ["role", "labels", "form"];
|
|
177
|
+
function walkTree(tree = document.body) {
|
|
178
|
+
const treeWalker = document.createTreeWalker(tree, globalThis.NodeFilter.SHOW_ELEMENT, null, false);
|
|
179
|
+
let node = treeWalker.currentNode;
|
|
180
|
+
while (node) {
|
|
181
|
+
const elementInternals = getElementInternals(node);
|
|
182
|
+
if (elementInternals) {
|
|
183
|
+
const ancestry = getAncestry(node);
|
|
184
|
+
const internals = {};
|
|
185
|
+
for (const prop in elementInternals) {
|
|
186
|
+
if (!ariaPropRegex.test(prop) && !propsToCapture.includes(prop)) {
|
|
187
|
+
continue;
|
|
188
|
+
}
|
|
189
|
+
try {
|
|
190
|
+
const value = elementInternals[prop];
|
|
191
|
+
if (value === null) {
|
|
192
|
+
continue;
|
|
193
|
+
}
|
|
194
|
+
if (value instanceof globalThis.HTMLElement) {
|
|
195
|
+
internals[prop] = value.isConnected ? {type: "HTMLElement", value: getAncestry(value)} : void 0;
|
|
196
|
+
} else if (Array.isArray(value) || value instanceof globalThis.NodeList) {
|
|
197
|
+
const array = Array.from(value).filter((n) => n.isConnected);
|
|
198
|
+
internals[prop] = array.length ? {type: "NodeList", value: array.map((n) => getAncestry(n))} : void 0;
|
|
199
|
+
} else if (typeof value === "string") {
|
|
200
|
+
internals[prop] = value;
|
|
201
|
+
}
|
|
202
|
+
} catch {
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
elementInternalsMap.push({
|
|
206
|
+
ancestry,
|
|
207
|
+
internals
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
if (is_shadow_root_default(node)) {
|
|
211
|
+
walkTree(node.shadowRoot);
|
|
212
|
+
}
|
|
213
|
+
node = treeWalker.nextNode();
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
return require_main();
|
|
217
|
+
})();
|
|
218
|
+
return elementInternalsMap;
|
|
219
|
+
})();
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Localizations
|
|
2
|
+
|
|
3
|
+
We welcome any localization for axe-core. For details on how to contribute, see the [Contributing section](../README.md#contributing) of the main README. For details on the message syntax, see [Check Message Template](../doc/check-message-template.md).
|
|
4
|
+
|
|
5
|
+
To create a new translation for axe, start by running `grunt translate --lang=<langcode>`. This will create a JSON file with the default English text in it for you to translate. Alternatively, you could copy `_template.json`.
|
|
6
|
+
|
|
7
|
+
To update an existing translation file, re-run `grunt translate --lang=<langcode>`. This will add new messages used in English and remove messages that are no longer used in English.
|
|
8
|
+
|
|
9
|
+
`_template.json` is a generated file which is created every time axe is built. It's compiled using each rule's `description` and `help` properties, as well as each check's `metadata.messages` property. To update the `_template.json` file you'll need to update the corresponding [rule](../lib/rules) or [check](../lib/checks) metadata file and rebuild.
|