entree 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile +10 -0
- data/LICENSE.txt +22 -0
- data/README.md +128 -0
- data/Rakefile +31 -0
- data/bin/entree +9 -0
- data/entree.gemspec +28 -0
- data/lib/entree/audit.rb +45 -0
- data/lib/entree/cli.rb +16 -0
- data/lib/entree/runner.rb +31 -0
- data/lib/entree/version.rb +3 -0
- data/lib/entree.rb +11 -0
- data/test/entree/audit_test.rb +30 -0
- data/test/entree/cli_test.rb +11 -0
- data/test/entree/runner_test.rb +13 -0
- data/vendor/HTML_CodeSniffer/Contrib/PhantomJS/HTMLCS_Run.js +180 -0
- data/vendor/HTML_CodeSniffer/build/HTMLCS.js +33 -0
- data/vendor/access-lint/README.md +34 -0
- data/vendor/access-lint/bin/auditor.js +62 -0
- data/vendor/google-chrome/accessibility-developer-tools/README.md +173 -0
- data/vendor/google-chrome/accessibility-developer-tools/gen/axs_testing.js +2052 -0
- metadata +151 -0
@@ -0,0 +1,2052 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright 2015 Google Inc.
|
3
|
+
*
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
* you may not use this file except in compliance with the License.
|
6
|
+
* You may obtain a copy of the License at
|
7
|
+
*
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
*
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
* See the License for the specific language governing permissions and
|
14
|
+
* limitations under the License.
|
15
|
+
*
|
16
|
+
* Generated from http://github.com/GoogleChrome/accessibility-developer-tools/tree/22e4b17455b96fbb262c6093c5f8bca82822bab0
|
17
|
+
*
|
18
|
+
* See project README for build steps.
|
19
|
+
*/
|
20
|
+
|
21
|
+
// AUTO-GENERATED CONTENT BELOW: DO NOT EDIT! See above for details.
|
22
|
+
|
23
|
+
var COMPILED = !0, goog = goog || {};
|
24
|
+
goog.global = this;
|
25
|
+
goog.isDef = function(a) {
|
26
|
+
return void 0 !== a;
|
27
|
+
};
|
28
|
+
goog.exportPath_ = function(a, b, c) {
|
29
|
+
a = a.split(".");
|
30
|
+
c = c || goog.global;
|
31
|
+
a[0] in c || !c.execScript || c.execScript("var " + a[0]);
|
32
|
+
for (var d;a.length && (d = a.shift());) {
|
33
|
+
!a.length && goog.isDef(b) ? c[d] = b : c = c[d] ? c[d] : c[d] = {};
|
34
|
+
}
|
35
|
+
};
|
36
|
+
goog.define = function(a, b) {
|
37
|
+
var c = b;
|
38
|
+
COMPILED || (goog.global.CLOSURE_UNCOMPILED_DEFINES && Object.prototype.hasOwnProperty.call(goog.global.CLOSURE_UNCOMPILED_DEFINES, a) ? c = goog.global.CLOSURE_UNCOMPILED_DEFINES[a] : goog.global.CLOSURE_DEFINES && Object.prototype.hasOwnProperty.call(goog.global.CLOSURE_DEFINES, a) && (c = goog.global.CLOSURE_DEFINES[a]));
|
39
|
+
goog.exportPath_(a, c);
|
40
|
+
};
|
41
|
+
goog.DEBUG = !0;
|
42
|
+
goog.LOCALE = "en";
|
43
|
+
goog.TRUSTED_SITE = !0;
|
44
|
+
goog.STRICT_MODE_COMPATIBLE = !1;
|
45
|
+
goog.provide = function(a) {
|
46
|
+
if (!COMPILED) {
|
47
|
+
if (goog.isProvided_(a)) {
|
48
|
+
throw Error('Namespace "' + a + '" already declared.');
|
49
|
+
}
|
50
|
+
delete goog.implicitNamespaces_[a];
|
51
|
+
for (var b = a;(b = b.substring(0, b.lastIndexOf("."))) && !goog.getObjectByName(b);) {
|
52
|
+
goog.implicitNamespaces_[b] = !0;
|
53
|
+
}
|
54
|
+
}
|
55
|
+
goog.exportPath_(a);
|
56
|
+
};
|
57
|
+
goog.setTestOnly = function(a) {
|
58
|
+
if (COMPILED && !goog.DEBUG) {
|
59
|
+
throw a = a || "", Error("Importing test-only code into non-debug environment" + a ? ": " + a : ".");
|
60
|
+
}
|
61
|
+
};
|
62
|
+
goog.forwardDeclare = function(a) {
|
63
|
+
};
|
64
|
+
COMPILED || (goog.isProvided_ = function(a) {
|
65
|
+
return !goog.implicitNamespaces_[a] && goog.isDefAndNotNull(goog.getObjectByName(a));
|
66
|
+
}, goog.implicitNamespaces_ = {});
|
67
|
+
goog.getObjectByName = function(a, b) {
|
68
|
+
for (var c = a.split("."), d = b || goog.global, e;e = c.shift();) {
|
69
|
+
if (goog.isDefAndNotNull(d[e])) {
|
70
|
+
d = d[e];
|
71
|
+
} else {
|
72
|
+
return null;
|
73
|
+
}
|
74
|
+
}
|
75
|
+
return d;
|
76
|
+
};
|
77
|
+
goog.globalize = function(a, b) {
|
78
|
+
var c = b || goog.global, d;
|
79
|
+
for (d in a) {
|
80
|
+
c[d] = a[d];
|
81
|
+
}
|
82
|
+
};
|
83
|
+
goog.addDependency = function(a, b, c) {
|
84
|
+
if (goog.DEPENDENCIES_ENABLED) {
|
85
|
+
var d;
|
86
|
+
a = a.replace(/\\/g, "/");
|
87
|
+
for (var e = goog.dependencies_, f = 0;d = b[f];f++) {
|
88
|
+
e.nameToPath[d] = a, a in e.pathToNames || (e.pathToNames[a] = {}), e.pathToNames[a][d] = !0;
|
89
|
+
}
|
90
|
+
for (d = 0;b = c[d];d++) {
|
91
|
+
a in e.requires || (e.requires[a] = {}), e.requires[a][b] = !0;
|
92
|
+
}
|
93
|
+
}
|
94
|
+
};
|
95
|
+
goog.ENABLE_DEBUG_LOADER = !0;
|
96
|
+
goog.require = function(a) {
|
97
|
+
if (!COMPILED && !goog.isProvided_(a)) {
|
98
|
+
if (goog.ENABLE_DEBUG_LOADER) {
|
99
|
+
var b = goog.getPathFromDeps_(a);
|
100
|
+
if (b) {
|
101
|
+
goog.included_[b] = !0;
|
102
|
+
goog.writeScripts_();
|
103
|
+
return;
|
104
|
+
}
|
105
|
+
}
|
106
|
+
a = "goog.require could not find: " + a;
|
107
|
+
goog.global.console && goog.global.console.error(a);
|
108
|
+
throw Error(a);
|
109
|
+
}
|
110
|
+
};
|
111
|
+
goog.basePath = "";
|
112
|
+
goog.nullFunction = function() {
|
113
|
+
};
|
114
|
+
goog.identityFunction = function(a, b) {
|
115
|
+
return a;
|
116
|
+
};
|
117
|
+
goog.abstractMethod = function() {
|
118
|
+
throw Error("unimplemented abstract method");
|
119
|
+
};
|
120
|
+
goog.addSingletonGetter = function(a) {
|
121
|
+
a.getInstance = function() {
|
122
|
+
if (a.instance_) {
|
123
|
+
return a.instance_;
|
124
|
+
}
|
125
|
+
goog.DEBUG && (goog.instantiatedSingletons_[goog.instantiatedSingletons_.length] = a);
|
126
|
+
return a.instance_ = new a;
|
127
|
+
};
|
128
|
+
};
|
129
|
+
goog.instantiatedSingletons_ = [];
|
130
|
+
goog.DEPENDENCIES_ENABLED = !COMPILED && goog.ENABLE_DEBUG_LOADER;
|
131
|
+
goog.DEPENDENCIES_ENABLED && (goog.included_ = {}, goog.dependencies_ = {pathToNames:{}, nameToPath:{}, requires:{}, visited:{}, written:{}}, goog.inHtmlDocument_ = function() {
|
132
|
+
var a = goog.global.document;
|
133
|
+
return "undefined" != typeof a && "write" in a;
|
134
|
+
}, goog.findBasePath_ = function() {
|
135
|
+
if (goog.global.CLOSURE_BASE_PATH) {
|
136
|
+
goog.basePath = goog.global.CLOSURE_BASE_PATH;
|
137
|
+
} else {
|
138
|
+
if (goog.inHtmlDocument_()) {
|
139
|
+
for (var a = goog.global.document.getElementsByTagName("script"), b = a.length - 1;0 <= b;--b) {
|
140
|
+
var c = a[b].src, d = c.lastIndexOf("?"), d = -1 == d ? c.length : d;
|
141
|
+
if ("base.js" == c.substr(d - 7, 7)) {
|
142
|
+
goog.basePath = c.substr(0, d - 7);
|
143
|
+
break;
|
144
|
+
}
|
145
|
+
}
|
146
|
+
}
|
147
|
+
}
|
148
|
+
}, goog.importScript_ = function(a) {
|
149
|
+
var b = goog.global.CLOSURE_IMPORT_SCRIPT || goog.writeScriptTag_;
|
150
|
+
!goog.dependencies_.written[a] && b(a) && (goog.dependencies_.written[a] = !0);
|
151
|
+
}, goog.writeScriptTag_ = function(a) {
|
152
|
+
if (goog.inHtmlDocument_()) {
|
153
|
+
var b = goog.global.document;
|
154
|
+
if ("complete" == b.readyState) {
|
155
|
+
if (/\bdeps.js$/.test(a)) {
|
156
|
+
return !1;
|
157
|
+
}
|
158
|
+
throw Error('Cannot write "' + a + '" after document load');
|
159
|
+
}
|
160
|
+
b.write('<script type="text/javascript" src="' + a + '">\x3c/script>');
|
161
|
+
return !0;
|
162
|
+
}
|
163
|
+
return !1;
|
164
|
+
}, goog.writeScripts_ = function() {
|
165
|
+
function a(e) {
|
166
|
+
if (!(e in d.written)) {
|
167
|
+
if (!(e in d.visited) && (d.visited[e] = !0, e in d.requires)) {
|
168
|
+
for (var g in d.requires[e]) {
|
169
|
+
if (!goog.isProvided_(g)) {
|
170
|
+
if (g in d.nameToPath) {
|
171
|
+
a(d.nameToPath[g]);
|
172
|
+
} else {
|
173
|
+
throw Error("Undefined nameToPath for " + g);
|
174
|
+
}
|
175
|
+
}
|
176
|
+
}
|
177
|
+
}
|
178
|
+
e in c || (c[e] = !0, b.push(e));
|
179
|
+
}
|
180
|
+
}
|
181
|
+
var b = [], c = {}, d = goog.dependencies_, e;
|
182
|
+
for (e in goog.included_) {
|
183
|
+
d.written[e] || a(e);
|
184
|
+
}
|
185
|
+
for (e = 0;e < b.length;e++) {
|
186
|
+
if (b[e]) {
|
187
|
+
goog.importScript_(goog.basePath + b[e]);
|
188
|
+
} else {
|
189
|
+
throw Error("Undefined script input");
|
190
|
+
}
|
191
|
+
}
|
192
|
+
}, goog.getPathFromDeps_ = function(a) {
|
193
|
+
return a in goog.dependencies_.nameToPath ? goog.dependencies_.nameToPath[a] : null;
|
194
|
+
}, goog.findBasePath_(), goog.global.CLOSURE_NO_DEPS || goog.importScript_(goog.basePath + "deps.js"));
|
195
|
+
goog.typeOf = function(a) {
|
196
|
+
var b = typeof a;
|
197
|
+
if ("object" == b) {
|
198
|
+
if (a) {
|
199
|
+
if (a instanceof Array) {
|
200
|
+
return "array";
|
201
|
+
}
|
202
|
+
if (a instanceof Object) {
|
203
|
+
return b;
|
204
|
+
}
|
205
|
+
var c = Object.prototype.toString.call(a);
|
206
|
+
if ("[object Window]" == c) {
|
207
|
+
return "object";
|
208
|
+
}
|
209
|
+
if ("[object Array]" == c || "number" == typeof a.length && "undefined" != typeof a.splice && "undefined" != typeof a.propertyIsEnumerable && !a.propertyIsEnumerable("splice")) {
|
210
|
+
return "array";
|
211
|
+
}
|
212
|
+
if ("[object Function]" == c || "undefined" != typeof a.call && "undefined" != typeof a.propertyIsEnumerable && !a.propertyIsEnumerable("call")) {
|
213
|
+
return "function";
|
214
|
+
}
|
215
|
+
} else {
|
216
|
+
return "null";
|
217
|
+
}
|
218
|
+
} else {
|
219
|
+
if ("function" == b && "undefined" == typeof a.call) {
|
220
|
+
return "object";
|
221
|
+
}
|
222
|
+
}
|
223
|
+
return b;
|
224
|
+
};
|
225
|
+
goog.isNull = function(a) {
|
226
|
+
return null === a;
|
227
|
+
};
|
228
|
+
goog.isDefAndNotNull = function(a) {
|
229
|
+
return null != a;
|
230
|
+
};
|
231
|
+
goog.isArray = function(a) {
|
232
|
+
return "array" == goog.typeOf(a);
|
233
|
+
};
|
234
|
+
goog.isArrayLike = function(a) {
|
235
|
+
var b = goog.typeOf(a);
|
236
|
+
return "array" == b || "object" == b && "number" == typeof a.length;
|
237
|
+
};
|
238
|
+
goog.isDateLike = function(a) {
|
239
|
+
return goog.isObject(a) && "function" == typeof a.getFullYear;
|
240
|
+
};
|
241
|
+
goog.isString = function(a) {
|
242
|
+
return "string" == typeof a;
|
243
|
+
};
|
244
|
+
goog.isBoolean = function(a) {
|
245
|
+
return "boolean" == typeof a;
|
246
|
+
};
|
247
|
+
goog.isNumber = function(a) {
|
248
|
+
return "number" == typeof a;
|
249
|
+
};
|
250
|
+
goog.isFunction = function(a) {
|
251
|
+
return "function" == goog.typeOf(a);
|
252
|
+
};
|
253
|
+
goog.isObject = function(a) {
|
254
|
+
var b = typeof a;
|
255
|
+
return "object" == b && null != a || "function" == b;
|
256
|
+
};
|
257
|
+
goog.getUid = function(a) {
|
258
|
+
return a[goog.UID_PROPERTY_] || (a[goog.UID_PROPERTY_] = ++goog.uidCounter_);
|
259
|
+
};
|
260
|
+
goog.hasUid = function(a) {
|
261
|
+
return !!a[goog.UID_PROPERTY_];
|
262
|
+
};
|
263
|
+
goog.removeUid = function(a) {
|
264
|
+
"removeAttribute" in a && a.removeAttribute(goog.UID_PROPERTY_);
|
265
|
+
try {
|
266
|
+
delete a[goog.UID_PROPERTY_];
|
267
|
+
} catch (b) {
|
268
|
+
}
|
269
|
+
};
|
270
|
+
goog.UID_PROPERTY_ = "closure_uid_" + (1E9 * Math.random() >>> 0);
|
271
|
+
goog.uidCounter_ = 0;
|
272
|
+
goog.getHashCode = goog.getUid;
|
273
|
+
goog.removeHashCode = goog.removeUid;
|
274
|
+
goog.cloneObject = function(a) {
|
275
|
+
var b = goog.typeOf(a);
|
276
|
+
if ("object" == b || "array" == b) {
|
277
|
+
if (a.clone) {
|
278
|
+
return a.clone();
|
279
|
+
}
|
280
|
+
var b = "array" == b ? [] : {}, c;
|
281
|
+
for (c in a) {
|
282
|
+
b[c] = goog.cloneObject(a[c]);
|
283
|
+
}
|
284
|
+
return b;
|
285
|
+
}
|
286
|
+
return a;
|
287
|
+
};
|
288
|
+
goog.bindNative_ = function(a, b, c) {
|
289
|
+
return a.call.apply(a.bind, arguments);
|
290
|
+
};
|
291
|
+
goog.bindJs_ = function(a, b, c) {
|
292
|
+
if (!a) {
|
293
|
+
throw Error();
|
294
|
+
}
|
295
|
+
if (2 < arguments.length) {
|
296
|
+
var d = Array.prototype.slice.call(arguments, 2);
|
297
|
+
return function() {
|
298
|
+
var c = Array.prototype.slice.call(arguments);
|
299
|
+
Array.prototype.unshift.apply(c, d);
|
300
|
+
return a.apply(b, c);
|
301
|
+
};
|
302
|
+
}
|
303
|
+
return function() {
|
304
|
+
return a.apply(b, arguments);
|
305
|
+
};
|
306
|
+
};
|
307
|
+
goog.bind = function(a, b, c) {
|
308
|
+
Function.prototype.bind && -1 != Function.prototype.bind.toString().indexOf("native code") ? goog.bind = goog.bindNative_ : goog.bind = goog.bindJs_;
|
309
|
+
return goog.bind.apply(null, arguments);
|
310
|
+
};
|
311
|
+
goog.partial = function(a, b) {
|
312
|
+
var c = Array.prototype.slice.call(arguments, 1);
|
313
|
+
return function() {
|
314
|
+
var b = c.slice();
|
315
|
+
b.push.apply(b, arguments);
|
316
|
+
return a.apply(this, b);
|
317
|
+
};
|
318
|
+
};
|
319
|
+
goog.mixin = function(a, b) {
|
320
|
+
for (var c in b) {
|
321
|
+
a[c] = b[c];
|
322
|
+
}
|
323
|
+
};
|
324
|
+
goog.now = goog.TRUSTED_SITE && Date.now || function() {
|
325
|
+
return +new Date;
|
326
|
+
};
|
327
|
+
goog.globalEval = function(a) {
|
328
|
+
if (goog.global.execScript) {
|
329
|
+
goog.global.execScript(a, "JavaScript");
|
330
|
+
} else {
|
331
|
+
if (goog.global.eval) {
|
332
|
+
if (null == goog.evalWorksForGlobals_ && (goog.global.eval("var _et_ = 1;"), "undefined" != typeof goog.global._et_ ? (delete goog.global._et_, goog.evalWorksForGlobals_ = !0) : goog.evalWorksForGlobals_ = !1), goog.evalWorksForGlobals_) {
|
333
|
+
goog.global.eval(a);
|
334
|
+
} else {
|
335
|
+
var b = goog.global.document, c = b.createElement("script");
|
336
|
+
c.type = "text/javascript";
|
337
|
+
c.defer = !1;
|
338
|
+
c.appendChild(b.createTextNode(a));
|
339
|
+
b.body.appendChild(c);
|
340
|
+
b.body.removeChild(c);
|
341
|
+
}
|
342
|
+
} else {
|
343
|
+
throw Error("goog.globalEval not available");
|
344
|
+
}
|
345
|
+
}
|
346
|
+
};
|
347
|
+
goog.evalWorksForGlobals_ = null;
|
348
|
+
goog.getCssName = function(a, b) {
|
349
|
+
var c = function(a) {
|
350
|
+
return goog.cssNameMapping_[a] || a;
|
351
|
+
}, d = function(a) {
|
352
|
+
a = a.split("-");
|
353
|
+
for (var b = [], d = 0;d < a.length;d++) {
|
354
|
+
b.push(c(a[d]));
|
355
|
+
}
|
356
|
+
return b.join("-");
|
357
|
+
}, d = goog.cssNameMapping_ ? "BY_WHOLE" == goog.cssNameMappingStyle_ ? c : d : function(a) {
|
358
|
+
return a;
|
359
|
+
};
|
360
|
+
return b ? a + "-" + d(b) : d(a);
|
361
|
+
};
|
362
|
+
goog.setCssNameMapping = function(a, b) {
|
363
|
+
goog.cssNameMapping_ = a;
|
364
|
+
goog.cssNameMappingStyle_ = b;
|
365
|
+
};
|
366
|
+
!COMPILED && goog.global.CLOSURE_CSS_NAME_MAPPING && (goog.cssNameMapping_ = goog.global.CLOSURE_CSS_NAME_MAPPING);
|
367
|
+
goog.getMsg = function(a, b) {
|
368
|
+
var c = b || {}, d;
|
369
|
+
for (d in c) {
|
370
|
+
var e = ("" + c[d]).replace(/\$/g, "$$$$");
|
371
|
+
a = a.replace(new RegExp("\\{\\$" + d + "\\}", "gi"), e);
|
372
|
+
}
|
373
|
+
return a;
|
374
|
+
};
|
375
|
+
goog.getMsgWithFallback = function(a, b) {
|
376
|
+
return a;
|
377
|
+
};
|
378
|
+
goog.exportSymbol = function(a, b, c) {
|
379
|
+
goog.exportPath_(a, b, c);
|
380
|
+
};
|
381
|
+
goog.exportProperty = function(a, b, c) {
|
382
|
+
a[b] = c;
|
383
|
+
};
|
384
|
+
goog.inherits = function(a, b) {
|
385
|
+
function c() {
|
386
|
+
}
|
387
|
+
c.prototype = b.prototype;
|
388
|
+
a.superClass_ = b.prototype;
|
389
|
+
a.prototype = new c;
|
390
|
+
a.prototype.constructor = a;
|
391
|
+
a.base = function(a, c, f) {
|
392
|
+
var g = Array.prototype.slice.call(arguments, 2);
|
393
|
+
return b.prototype[c].apply(a, g);
|
394
|
+
};
|
395
|
+
};
|
396
|
+
goog.base = function(a, b, c) {
|
397
|
+
var d = arguments.callee.caller;
|
398
|
+
if (goog.STRICT_MODE_COMPATIBLE || goog.DEBUG && !d) {
|
399
|
+
throw Error("arguments.caller not defined. goog.base() cannot be used with strict mode code. See http://www.ecma-international.org/ecma-262/5.1/#sec-C");
|
400
|
+
}
|
401
|
+
if (d.superClass_) {
|
402
|
+
return d.superClass_.constructor.apply(a, Array.prototype.slice.call(arguments, 1));
|
403
|
+
}
|
404
|
+
for (var e = Array.prototype.slice.call(arguments, 2), f = !1, g = a.constructor;g;g = g.superClass_ && g.superClass_.constructor) {
|
405
|
+
if (g.prototype[b] === d) {
|
406
|
+
f = !0;
|
407
|
+
} else {
|
408
|
+
if (f) {
|
409
|
+
return g.prototype[b].apply(a, e);
|
410
|
+
}
|
411
|
+
}
|
412
|
+
}
|
413
|
+
if (a[b] === d) {
|
414
|
+
return a.constructor.prototype[b].apply(a, e);
|
415
|
+
}
|
416
|
+
throw Error("goog.base called from a method of one name to a method of a different name");
|
417
|
+
};
|
418
|
+
goog.scope = function(a) {
|
419
|
+
a.call(goog.global);
|
420
|
+
};
|
421
|
+
var axs = {};
|
422
|
+
axs.browserUtils = {};
|
423
|
+
axs.browserUtils.matchSelector = function(a, b) {
|
424
|
+
return a.webkitMatchesSelector ? a.webkitMatchesSelector(b) : a.mozMatchesSelector ? a.mozMatchesSelector(b) : a.msMatchesSelector ? a.msMatchesSelector(b) : !1;
|
425
|
+
};
|
426
|
+
axs.constants = {};
|
427
|
+
axs.constants.ARIA_ROLES = {alert:{namefrom:["author"], parent:["region"]}, alertdialog:{namefrom:["author"], namerequired:!0, parent:["alert", "dialog"]}, application:{namefrom:["author"], namerequired:!0, parent:["landmark"]}, article:{namefrom:["author"], parent:["document", "region"]}, banner:{namefrom:["author"], parent:["landmark"]}, button:{childpresentational:!0, namefrom:["contents", "author"], namerequired:!0, parent:["command"], properties:["aria-expanded", "aria-pressed"]}, checkbox:{namefrom:["contents",
|
428
|
+
"author"], namerequired:!0, parent:["input"], requiredProperties:["aria-checked"], properties:["aria-checked"]}, columnheader:{namefrom:["contents", "author"], namerequired:!0, parent:["gridcell", "sectionhead", "widget"], properties:["aria-sort"], scope:["row"]}, combobox:{mustcontain:["listbox", "textbox"], namefrom:["author"], namerequired:!0, parent:["select"], requiredProperties:["aria-expanded"], properties:["aria-expanded", "aria-autocomplete", "aria-required"]}, command:{"abstract":!0, namefrom:["author"],
|
429
|
+
parent:["widget"]}, complementary:{namefrom:["author"], parent:["landmark"]}, composite:{"abstract":!0, childpresentational:!1, namefrom:["author"], parent:["widget"], properties:["aria-activedescendant"]}, contentinfo:{namefrom:["author"], parent:["landmark"]}, definition:{namefrom:["author"], parent:["section"]}, dialog:{namefrom:["author"], namerequired:!0, parent:["window"]}, directory:{namefrom:["contents", "author"], parent:["list"]}, document:{namefrom:[" author"], namerequired:!0, parent:["structure"],
|
430
|
+
properties:["aria-expanded"]}, form:{namefrom:["author"], parent:["landmark"]}, grid:{mustcontain:["row", "rowgroup"], namefrom:["author"], namerequired:!0, parent:["composite", "region"], properties:["aria-level", "aria-multiselectable", "aria-readonly"]}, gridcell:{namefrom:["contents", "author"], namerequired:!0, parent:["section", "widget"], properties:["aria-readonly", "aria-required", "aria-selected"], scope:["row"]}, group:{namefrom:[" author"], parent:["section"], properties:["aria-activedescendant"]},
|
431
|
+
heading:{namerequired:!0, parent:["sectionhead"], properties:["aria-level"]}, img:{childpresentational:!0, namefrom:["author"], namerequired:!0, parent:["section"]}, input:{"abstract":!0, namefrom:["author"], parent:["widget"]}, landmark:{"abstract":!0, namefrom:["contents", "author"], namerequired:!1, parent:["region"]}, link:{namefrom:["contents", "author"], namerequired:!0, parent:["command"], properties:["aria-expanded"]}, list:{mustcontain:["group", "listitem"], namefrom:["author"], parent:["region"]},
|
432
|
+
listbox:{mustcontain:["option"], namefrom:["author"], namerequired:!0, parent:["list", "select"], properties:["aria-multiselectable", "aria-required"]}, listitem:{namefrom:["contents", "author"], namerequired:!0, parent:["section"], properties:["aria-level", "aria-posinset", "aria-setsize"], scope:["list"]}, log:{namefrom:[" author"], namerequired:!0, parent:["region"]}, main:{namefrom:["author"], parent:["landmark"]}, marquee:{namerequired:!0, parent:["section"]}, math:{childpresentational:!0, namefrom:["author"],
|
433
|
+
parent:["section"]}, menu:{mustcontain:["group", "menuitemradio", "menuitem", "menuitemcheckbox"], namefrom:["author"], namerequired:!0, parent:["list", "select"]}, menubar:{namefrom:["author"], parent:["menu"]}, menuitem:{namefrom:["contents", "author"], namerequired:!0, parent:["command"], scope:["menu", "menubar"]}, menuitemcheckbox:{namefrom:["contents", "author"], namerequired:!0, parent:["checkbox", "menuitem"], scope:["menu", "menubar"]}, menuitemradio:{namefrom:["contents", "author"], namerequired:!0,
|
434
|
+
parent:["menuitemcheckbox", "radio"], scope:["menu", "menubar"]}, navigation:{namefrom:["author"], parent:["landmark"]}, note:{namefrom:["author"], parent:["section"]}, option:{namefrom:["contents", "author"], namerequired:!0, parent:["input"], properties:["aria-checked", "aria-posinset", "aria-selected", "aria-setsize"]}, presentation:{parent:["structure"]}, progressbar:{childpresentational:!0, namefrom:["author"], namerequired:!0, parent:["range"]}, radio:{namefrom:["contents", "author"], namerequired:!0,
|
435
|
+
parent:["checkbox", "option"]}, radiogroup:{mustcontain:["radio"], namefrom:["author"], namerequired:!0, parent:["select"], properties:["aria-required"]}, range:{"abstract":!0, namefrom:["author"], parent:["widget"], properties:["aria-valuemax", "aria-valuemin", "aria-valuenow", "aria-valuetext"]}, region:{namefrom:[" author"], parent:["section"]}, roletype:{"abstract":!0, properties:"aria-atomic aria-busy aria-controls aria-describedby aria-disabled aria-dropeffect aria-flowto aria-grabbed aria-haspopup aria-hidden aria-invalid aria-label aria-labelledby aria-live aria-owns aria-relevant".split(" ")},
|
436
|
+
row:{mustcontain:["columnheader", "gridcell", "rowheader"], namefrom:["contents", "author"], parent:["group", "widget"], properties:["aria-level", "aria-selected"], scope:["grid", "rowgroup", "treegrid"]}, rowgroup:{mustcontain:["row"], namefrom:["contents", "author"], parent:["group"], scope:["grid"]}, rowheader:{namefrom:["contents", "author"], namerequired:!0, parent:["gridcell", "sectionhead", "widget"], properties:["aria-sort"], scope:["row"]}, search:{namefrom:["author"], parent:["landmark"]},
|
437
|
+
section:{"abstract":!0, namefrom:["contents", "author"], parent:["structure"], properties:["aria-expanded"]}, sectionhead:{"abstract":!0, namefrom:["contents", "author"], parent:["structure"], properties:["aria-expanded"]}, select:{"abstract":!0, namefrom:["author"], parent:["composite", "group", "input"]}, separator:{childpresentational:!0, namefrom:["author"], parent:["structure"], properties:["aria-expanded", "aria-orientation"]}, scrollbar:{childpresentational:!0, namefrom:["author"], namerequired:!1,
|
438
|
+
parent:["input", "range"], requiredProperties:["aria-controls", "aria-orientation", "aria-valuemax", "aria-valuemin", "aria-valuenow"], properties:["aria-controls", "aria-orientation", "aria-valuemax", "aria-valuemin", "aria-valuenow"]}, slider:{childpresentational:!0, namefrom:["author"], namerequired:!0, parent:["input", "range"], requiredProperties:["aria-valuemax", "aria-valuemin", "aria-valuenow"], properties:["aria-valuemax", "aria-valuemin", "aria-valuenow", "aria-orientation"]}, spinbutton:{namefrom:["author"],
|
439
|
+
namerequired:!0, parent:["input", "range"], requiredProperties:["aria-valuemax", "aria-valuemin", "aria-valuenow"], properties:["aria-valuemax", "aria-valuemin", "aria-valuenow", "aria-required"]}, status:{parent:["region"]}, structure:{"abstract":!0, parent:["roletype"]}, tab:{namefrom:["contents", "author"], parent:["sectionhead", "widget"], properties:["aria-selected"]}, tablist:{mustcontain:["tab"], namefrom:["author"], parent:["composite", "directory"], properties:["aria-level"], scope:["tablist"]},
|
440
|
+
tabpanel:{namefrom:["author"], namerequired:!0, parent:["region"]}, textbox:{namefrom:["author"], namerequired:!0, parent:["input"], properties:["aria-activedescendant", "aria-autocomplete", "aria-multiline", "aria-readonly", "aria-required"]}, timer:{namefrom:["author"], namerequired:!0, parent:["status"]}, toolbar:{namefrom:["author"], parent:["group"]}, tooltip:{namerequired:!0, parent:["section"]}, tree:{mustcontain:["group", "treeitem"], namefrom:["author"], namerequired:!0, parent:["select"],
|
441
|
+
properties:["aria-multiselectable", "aria-required"]}, treegrid:{mustcontain:["row"], namefrom:["author"], namerequired:!0, parent:["grid", "tree"]}, treeitem:{namefrom:["contents", "author"], namerequired:!0, parent:["listitem", "option"], scope:["group", "tree"]}, widget:{"abstract":!0, parent:["roletype"]}, window:{"abstract":!0, namefrom:[" author"], parent:["roletype"], properties:["aria-expanded"]}};
|
442
|
+
axs.constants.WIDGET_ROLES = {};
|
443
|
+
axs.constants.addAllParentRolesToSet_ = function(a, b) {
|
444
|
+
if (a.parent) {
|
445
|
+
for (var c = a.parent, d = 0;d < c.length;d++) {
|
446
|
+
var e = c[d];
|
447
|
+
b[e] = !0;
|
448
|
+
axs.constants.addAllParentRolesToSet_(axs.constants.ARIA_ROLES[e], b);
|
449
|
+
}
|
450
|
+
}
|
451
|
+
};
|
452
|
+
axs.constants.addAllPropertiesToSet_ = function(a, b, c) {
|
453
|
+
var d = a[b];
|
454
|
+
if (d) {
|
455
|
+
for (var e = 0;e < d.length;e++) {
|
456
|
+
c[d[e]] = !0;
|
457
|
+
}
|
458
|
+
}
|
459
|
+
if (a.parent) {
|
460
|
+
for (a = a.parent, d = 0;d < a.length;d++) {
|
461
|
+
axs.constants.addAllPropertiesToSet_(axs.constants.ARIA_ROLES[a[d]], b, c);
|
462
|
+
}
|
463
|
+
}
|
464
|
+
};
|
465
|
+
for (var roleName in axs.constants.ARIA_ROLES) {
|
466
|
+
var role = axs.constants.ARIA_ROLES[roleName], propertiesSet = {};
|
467
|
+
axs.constants.addAllPropertiesToSet_(role, "properties", propertiesSet);
|
468
|
+
role.propertiesSet = propertiesSet;
|
469
|
+
var requiredPropertiesSet = {};
|
470
|
+
axs.constants.addAllPropertiesToSet_(role, "requiredProperties", requiredPropertiesSet);
|
471
|
+
role.requiredPropertiesSet = requiredPropertiesSet;
|
472
|
+
var parentRolesSet = {};
|
473
|
+
axs.constants.addAllParentRolesToSet_(role, parentRolesSet);
|
474
|
+
role.allParentRolesSet = parentRolesSet;
|
475
|
+
"widget" in parentRolesSet && (axs.constants.WIDGET_ROLES[roleName] = role);
|
476
|
+
}
|
477
|
+
axs.constants.ARIA_PROPERTIES = {activedescendant:{type:"property", valueType:"idref"}, atomic:{defaultValue:"false", type:"property", valueType:"boolean"}, autocomplete:{defaultValue:"none", type:"property", valueType:"token", values:["inline", "list", "both", "none"]}, busy:{defaultValue:"false", type:"state", valueType:"boolean"}, checked:{defaultValue:"undefined", type:"state", valueType:"token", values:["true", "false", "mixed", "undefined"]}, controls:{type:"property", valueType:"idref_list"},
|
478
|
+
describedby:{type:"property", valueType:"idref_list"}, disabled:{defaultValue:"false", type:"state", valueType:"boolean"}, dropeffect:{defaultValue:"none", type:"property", valueType:"token_list", values:"copy move link execute popup none".split(" ")}, expanded:{defaultValue:"undefined", type:"state", valueType:"token", values:["true", "false", "undefined"]}, flowto:{type:"property", valueType:"idref_list"}, grabbed:{defaultValue:"undefined", type:"state", valueType:"token", values:["true", "false",
|
479
|
+
"undefined"]}, haspopup:{defaultValue:"false", type:"property", valueType:"boolean"}, hidden:{defaultValue:"false", type:"state", valueType:"boolean"}, invalid:{defaultValue:"false", type:"state", valueType:"token", values:["grammar", "false", "spelling", "true"]}, label:{type:"property", valueType:"string"}, labelledby:{type:"property", valueType:"idref_list"}, level:{type:"property", valueType:"integer"}, live:{defaultValue:"off", type:"property", valueType:"token", values:["off", "polite", "assertive"]},
|
480
|
+
multiline:{defaultValue:"false", type:"property", valueType:"boolean"}, multiselectable:{defaultValue:"false", type:"property", valueType:"boolean"}, orientation:{defaultValue:"vertical", type:"property", valueType:"token", values:["horizontal", "vertical"]}, owns:{type:"property", valueType:"idref_list"}, posinset:{type:"property", valueType:"integer"}, pressed:{defaultValue:"undefined", type:"state", valueType:"token", values:["true", "false", "mixed", "undefined"]}, readonly:{defaultValue:"false",
|
481
|
+
type:"property", valueType:"boolean"}, relevant:{defaultValue:"additions text", type:"property", valueType:"token_list", values:["additions", "removals", "text", "all"]}, required:{defaultValue:"false", type:"property", valueType:"boolean"}, selected:{defaultValue:"undefined", type:"state", valueType:"token", values:["true", "false", "undefined"]}, setsize:{type:"property", valueType:"integer"}, sort:{defaultValue:"none", type:"property", valueType:"token", values:["ascending", "descending", "none",
|
482
|
+
"other"]}, valuemax:{type:"property", valueType:"decimal"}, valuemin:{type:"property", valueType:"decimal"}, valuenow:{type:"property", valueType:"decimal"}, valuetext:{type:"property", valueType:"string"}};
|
483
|
+
axs.constants.GLOBAL_PROPERTIES = axs.constants.ARIA_ROLES.roletype.properties;
|
484
|
+
axs.constants.NO_ROLE_NAME = " ";
|
485
|
+
axs.constants.WIDGET_ROLE_TO_NAME = {alert:"aria_role_alert", alertdialog:"aria_role_alertdialog", button:"aria_role_button", checkbox:"aria_role_checkbox", columnheader:"aria_role_columnheader", combobox:"aria_role_combobox", dialog:"aria_role_dialog", grid:"aria_role_grid", gridcell:"aria_role_gridcell", link:"aria_role_link", listbox:"aria_role_listbox", log:"aria_role_log", marquee:"aria_role_marquee", menu:"aria_role_menu", menubar:"aria_role_menubar", menuitem:"aria_role_menuitem", menuitemcheckbox:"aria_role_menuitemcheckbox",
|
486
|
+
menuitemradio:"aria_role_menuitemradio", option:axs.constants.NO_ROLE_NAME, progressbar:"aria_role_progressbar", radio:"aria_role_radio", radiogroup:"aria_role_radiogroup", rowheader:"aria_role_rowheader", scrollbar:"aria_role_scrollbar", slider:"aria_role_slider", spinbutton:"aria_role_spinbutton", status:"aria_role_status", tab:"aria_role_tab", tabpanel:"aria_role_tabpanel", textbox:"aria_role_textbox", timer:"aria_role_timer", toolbar:"aria_role_toolbar", tooltip:"aria_role_tooltip", treeitem:"aria_role_treeitem"};
|
487
|
+
axs.constants.STRUCTURE_ROLE_TO_NAME = {article:"aria_role_article", application:"aria_role_application", banner:"aria_role_banner", columnheader:"aria_role_columnheader", complementary:"aria_role_complementary", contentinfo:"aria_role_contentinfo", definition:"aria_role_definition", directory:"aria_role_directory", document:"aria_role_document", form:"aria_role_form", group:"aria_role_group", heading:"aria_role_heading", img:"aria_role_img", list:"aria_role_list", listitem:"aria_role_listitem",
|
488
|
+
main:"aria_role_main", math:"aria_role_math", navigation:"aria_role_navigation", note:"aria_role_note", region:"aria_role_region", rowheader:"aria_role_rowheader", search:"aria_role_search", separator:"aria_role_separator"};
|
489
|
+
axs.constants.ATTRIBUTE_VALUE_TO_STATUS = [{name:"aria-autocomplete", values:{inline:"aria_autocomplete_inline", list:"aria_autocomplete_list", both:"aria_autocomplete_both"}}, {name:"aria-checked", values:{"true":"aria_checked_true", "false":"aria_checked_false", mixed:"aria_checked_mixed"}}, {name:"aria-disabled", values:{"true":"aria_disabled_true"}}, {name:"aria-expanded", values:{"true":"aria_expanded_true", "false":"aria_expanded_false"}}, {name:"aria-invalid", values:{"true":"aria_invalid_true",
|
490
|
+
grammar:"aria_invalid_grammar", spelling:"aria_invalid_spelling"}}, {name:"aria-multiline", values:{"true":"aria_multiline_true"}}, {name:"aria-multiselectable", values:{"true":"aria_multiselectable_true"}}, {name:"aria-pressed", values:{"true":"aria_pressed_true", "false":"aria_pressed_false", mixed:"aria_pressed_mixed"}}, {name:"aria-readonly", values:{"true":"aria_readonly_true"}}, {name:"aria-required", values:{"true":"aria_required_true"}}, {name:"aria-selected", values:{"true":"aria_selected_true",
|
491
|
+
"false":"aria_selected_false"}}];
|
492
|
+
axs.constants.INPUT_TYPE_TO_INFORMATION_TABLE_MSG = {button:"input_type_button", checkbox:"input_type_checkbox", color:"input_type_color", datetime:"input_type_datetime", "datetime-local":"input_type_datetime_local", date:"input_type_date", email:"input_type_email", file:"input_type_file", image:"input_type_image", month:"input_type_month", number:"input_type_number", password:"input_type_password", radio:"input_type_radio", range:"input_type_range", reset:"input_type_reset", search:"input_type_search",
|
493
|
+
submit:"input_type_submit", tel:"input_type_tel", text:"input_type_text", url:"input_type_url", week:"input_type_week"};
|
494
|
+
axs.constants.TAG_TO_INFORMATION_TABLE_VERBOSE_MSG = {A:"tag_link", BUTTON:"tag_button", H1:"tag_h1", H2:"tag_h2", H3:"tag_h3", H4:"tag_h4", H5:"tag_h5", H6:"tag_h6", LI:"tag_li", OL:"tag_ol", SELECT:"tag_select", TEXTAREA:"tag_textarea", UL:"tag_ul", SECTION:"tag_section", NAV:"tag_nav", ARTICLE:"tag_article", ASIDE:"tag_aside", HGROUP:"tag_hgroup", HEADER:"tag_header", FOOTER:"tag_footer", TIME:"tag_time", MARK:"tag_mark"};
|
495
|
+
axs.constants.TAG_TO_INFORMATION_TABLE_BRIEF_MSG = {BUTTON:"tag_button", SELECT:"tag_select", TEXTAREA:"tag_textarea"};
|
496
|
+
axs.constants.MIXED_VALUES = {"true":!0, "false":!0, mixed:!0};
|
497
|
+
(function() {
|
498
|
+
for (var a in axs.constants.ARIA_PROPERTIES) {
|
499
|
+
var b = axs.constants.ARIA_PROPERTIES[a];
|
500
|
+
if (b.values) {
|
501
|
+
for (var c = {}, d = 0;d < b.values.length;d++) {
|
502
|
+
c[b.values[d]] = !0;
|
503
|
+
}
|
504
|
+
b.valuesSet = c;
|
505
|
+
}
|
506
|
+
}
|
507
|
+
})();
|
508
|
+
axs.constants.Severity = {INFO:"Info", WARNING:"Warning", SEVERE:"Severe"};
|
509
|
+
axs.constants.AuditResult = {PASS:"PASS", FAIL:"FAIL", NA:"NA"};
|
510
|
+
axs.constants.InlineElements = {TT:!0, I:!0, B:!0, BIG:!0, SMALL:!0, EM:!0, STRONG:!0, DFN:!0, CODE:!0, SAMP:!0, KBD:!0, VAR:!0, CITE:!0, ABBR:!0, ACRONYM:!0, A:!0, IMG:!0, OBJECT:!0, BR:!0, SCRIPT:!0, MAP:!0, Q:!0, SUB:!0, SUP:!0, SPAN:!0, BDO:!0, INPUT:!0, SELECT:!0, TEXTAREA:!0, LABEL:!0, BUTTON:!0};
|
511
|
+
axs.constants.ARIA_TO_HTML_ATTRIBUTE = {"aria-checked":"checked", "aria-disabled":"disabled", "aria-hidden":"hidden", "aria-expanded":"open", "aria-valuemax":"max", "aria-valuemin":"min", "aria-readonly":"readonly", "aria-required":"required", "aria-selected":"selected", "aria-valuenow":"value"};
|
512
|
+
axs.constants.TAG_TO_IMPLICIT_SEMANTIC_INFO = {A:[{role:"link", allowed:"button checkbox menuitem menuitemcheckbox menuitemradio tab treeitem".split(" "), selector:"a[href]"}], ADDRESS:[{role:"", allowed:["contentinfo", "presentation"]}], AREA:[{role:"link", selector:"area[href]"}], ARTICLE:[{role:"article", allowed:["presentation", "article", "document", "application", "main"]}], ASIDE:[{role:"complementary", allowed:["note", "complementary", "search", "presentation"]}], AUDIO:[{role:"", allowed:["application",
|
513
|
+
"presentation"]}], BASE:[{role:"", reserved:!0}], BODY:[{role:"document", allowed:["presentation"]}], BUTTON:[{role:"button", allowed:["link", "menuitem", "menuitemcheckbox", "menuitemradio", "radio"], selector:'button:not([aria-pressed]):not([type="menu"])'}, {role:"button", allowed:["button"], selector:"button[aria-pressed]"}, {role:"button", attributes:{"aria-haspopup":!0}, allowed:["link", "menuitem", "menuitemcheckbox", "menuitemradio", "radio"], selector:'button[type="menu"]'}], CAPTION:[{role:"",
|
514
|
+
allowed:["presentation"]}], COL:[{role:"", reserved:!0}], COLGROUP:[{role:"", reserved:!0}], DATALIST:[{role:"listbox", attributes:{"aria-multiselectable":!1}, allowed:["presentation"]}], DEL:[{role:"", allowed:["*"]}], DD:[{role:"", allowed:["presentation"]}], DT:[{role:"", allowed:["presentation"]}], DETAILS:[{role:"group", allowed:["group", "presentation"]}], DIALOG:[{role:"dialog", allowed:"dialog alert alertdialog application log marquee status".split(" "), selector:"dialog[open]"}, {role:"dialog",
|
515
|
+
attributes:{"aria-hidden":!0}, allowed:"dialog alert alertdialog application log marquee status".split(" "), selector:"dialog:not([open])"}], DIV:[{role:"", allowed:["*"]}], DL:[{role:"list", allowed:["presentation"]}], EMBED:[{role:"", allowed:["application", "document", "img", "presentation"]}], FIGURE:[{role:"", allowed:["*"]}], FOOTER:[{role:"", allowed:["contentinfo", "presentation"]}], FORM:[{role:"form", allowed:["presentation"]}], P:[{role:"", allowed:["*"]}], PRE:[{role:"", allowed:["*"]}],
|
516
|
+
BLOCKQUOTE:[{role:"", allowed:["*"]}], H1:[{role:"heading"}], H2:[{role:"heading"}], H3:[{role:"heading"}], H4:[{role:"heading"}], H5:[{role:"heading"}], H6:[{role:"heading"}], HEAD:[{role:"", reserved:!0}], HEADER:[{role:"", allowed:["banner", "presentation"]}], HR:[{role:"separator", allowed:["presentation"]}], HTML:[{role:"", reserved:!0}], IFRAME:[{role:"", allowed:["application", "document", "img", "presentation"], selector:"iframe:not([seamless])"}, {role:"", allowed:["application", "document",
|
517
|
+
"img", "presentation", "group"], selector:"iframe[seamless]"}], IMG:[{role:"presentation", reserved:!0, selector:'img[alt=""]'}, {role:"img", allowed:["*"], selector:'img[alt]:not([alt=""])'}], INPUT:[{role:"button", allowed:["link", "menuitem", "menuitemcheckbox", "menuitemradio", "radio"], selector:'input[type="button"]:not([aria-pressed])'}, {role:"button", allowed:["button"], selector:'input[type="button"][aria-pressed]'}, {role:"checkbox", allowed:["checkbox"], selector:'input[type="checkbox"]'},
|
518
|
+
{role:"", selector:'input[type="color"]'}, {role:"", selector:'input[type="date"]'}, {role:"", selector:'input[type="datetime"]'}, {role:"textbox", selector:'input[type="email"]:not([list])'}, {role:"", selector:'input[type="file"]'}, {role:"", reserved:!0, selector:'input[type="hidden"]'}, {role:"button", allowed:["button"], selector:'input[type="image"][aria-pressed]'}, {role:"button", allowed:["link", "menuitem", "menuitemcheckbox", "menuitemradio", "radio"], selector:'input[type="image"]:not([aria-pressed])'},
|
519
|
+
{role:"", selector:'input[type="month"]'}, {role:"", selector:'input[type="number"]'}, {role:"textbox", selector:'input[type="password"]'}, {role:"radio", allowed:["menuitemradio"], selector:'input[type="radio"]'}, {role:"slider", selector:'input[type="range"]'}, {role:"button", selector:'input[type="reset"]'}, {role:"combobox", selector:'input[type="search"][list]'}, {role:"textbox", selector:'input[type="search"]:not([list])'}, {role:"button", selector:'input[type="submit"]'}, {role:"combobox",
|
520
|
+
selector:'input[type="tel"][list]'}, {role:"textbox", selector:'input[type="tel"]:not([list])'}, {role:"combobox", selector:'input[type="text"][list]'}, {role:"", selector:'input[type="text"]:not([list])'}, {role:"", selector:'input[type="time"]'}, {role:"combobox", selector:'input[type="url"][list]'}, {role:"textbox", selector:'input[type="url"]:not([list])'}, {role:"", selector:'input[type="week"]'}], INS:[{role:"", allowed:["*"]}], KEYGEN:[{role:""}], LABEL:[{role:"", allowed:["presentation"]}],
|
521
|
+
LI:[{role:"listitem", allowed:"menuitem menuitemcheckbox menuitemradio option tab treeitem presentation".split(" "), selector:'ol:not([role="presentation"])>li, ul:not([role="presentation"])>li'}, {role:"listitem", allowed:"listitem menuitem menuitemcheckbox menuitemradio option tab treeitem presentation".split(" "), selector:'ol[role="presentation"]>li, ul[role="presentation"]>li'}], LINK:[{role:"link", reserved:!0, selector:"link[href]"}], MAIN:[{role:"", allowed:["main", "presentation"]}], MAP:[{role:"",
|
522
|
+
reserved:!0}], MATH:[{role:"", allowed:["presentation"]}], MENU:[{role:"toolbar", selector:'menu[type="toolbar"]'}], MENUITEM:[{role:"menuitem", selector:'menuitem[type="command"]'}, {role:"menuitemcheckbox", selector:'menuitem[type="checkbox"]'}, {role:"menuitemradio", selector:'menuitem[type="radio"]'}], META:[{role:"", reserved:!0}], METER:[{role:"progressbar", allowed:["presentation"]}], NAV:[{role:"navigation", allowed:["navigation", "presentation"]}], NOSCRIPT:[{role:"", reserved:!0}], OBJECT:[{role:"",
|
523
|
+
allowed:["application", "document", "img", "presentation"]}], OL:[{role:"list", allowed:"directory group listbox menu menubar tablist toolbar tree presentation".split(" ")}], OPTGROUP:[{role:"", allowed:["presentation"]}], OPTION:[{role:"option"}], OUTPUT:[{role:"status", allowed:["*"]}], PARAM:[{role:"", reserved:!0}], PICTURE:[{role:"", reserved:!0}], PROGRESS:[{role:"progressbar", allowed:["presentation"]}], SCRIPT:[{role:"", reserved:!0}], SECTION:[{role:"region", allowed:"alert alertdialog application contentinfo dialog document log marquee search status presentation".split(" ")}],
|
524
|
+
SELECT:[{role:"listbox"}], SOURCE:[{role:"", reserved:!0}], SPAN:[{role:"", allowed:["*"]}], STYLE:[{role:"", reserved:!0}], SVG:[{role:"", allowed:["application", "document", "img", "presentation"]}], SUMMARY:[{role:"", allowed:["presentation"]}], TABLE:[{role:"", allowed:["*"]}], TEMPLATE:[{role:"", reserved:!0}], TEXTAREA:[{role:"textbox"}], TBODY:[{role:"rowgroup", allowed:["*"]}], THEAD:[{role:"rowgroup", allowed:["*"]}], TFOOT:[{role:"rowgroup", allowed:["*"]}], TITLE:[{role:"", reserved:!0}],
|
525
|
+
TD:[{role:"", allowed:["*"]}], TH:[{role:"", allowed:["*"]}], TR:[{role:"", allowed:["*"]}], TRACK:[{role:"", reserved:!0}], UL:[{role:"list", allowed:"directory group listbox menu menubar tablist toolbar tree presentation".split(" ")}], VIDEO:[{role:"", allowed:["application", "presentation"]}]};
|
526
|
+
axs.utils = {};
|
527
|
+
axs.utils.FOCUSABLE_ELEMENTS_SELECTOR = "input:not([type=hidden]):not([disabled]),select:not([disabled]),textarea:not([disabled]),button:not([disabled]),a[href],iframe,[tabindex]";
|
528
|
+
axs.utils.Color = function(a, b, c, d) {
|
529
|
+
this.red = a;
|
530
|
+
this.green = b;
|
531
|
+
this.blue = c;
|
532
|
+
this.alpha = d;
|
533
|
+
};
|
534
|
+
axs.utils.calculateContrastRatio = function(a, b) {
|
535
|
+
if (!a || !b) {
|
536
|
+
return null;
|
537
|
+
}
|
538
|
+
1 > a.alpha && (a = axs.utils.flattenColors(a, b));
|
539
|
+
var c = axs.utils.calculateLuminance(a), d = axs.utils.calculateLuminance(b);
|
540
|
+
return (Math.max(c, d) + .05) / (Math.min(c, d) + .05);
|
541
|
+
};
|
542
|
+
axs.utils.luminanceRatio = function(a, b) {
|
543
|
+
return (Math.max(a, b) + .05) / (Math.min(a, b) + .05);
|
544
|
+
};
|
545
|
+
axs.utils.parentElement = function(a) {
|
546
|
+
if (!a) {
|
547
|
+
return null;
|
548
|
+
}
|
549
|
+
if (a.nodeType == Node.DOCUMENT_FRAGMENT_NODE) {
|
550
|
+
return a.host;
|
551
|
+
}
|
552
|
+
var b = a.parentElement;
|
553
|
+
if (b) {
|
554
|
+
return b;
|
555
|
+
}
|
556
|
+
a = a.parentNode;
|
557
|
+
if (!a) {
|
558
|
+
return null;
|
559
|
+
}
|
560
|
+
switch(a.nodeType) {
|
561
|
+
case Node.ELEMENT_NODE:
|
562
|
+
return a;
|
563
|
+
case Node.DOCUMENT_FRAGMENT_NODE:
|
564
|
+
return a.host;
|
565
|
+
default:
|
566
|
+
return null;
|
567
|
+
}
|
568
|
+
};
|
569
|
+
axs.utils.asElement = function(a) {
|
570
|
+
switch(a.nodeType) {
|
571
|
+
case Node.COMMENT_NODE:
|
572
|
+
return null;
|
573
|
+
case Node.ELEMENT_NODE:
|
574
|
+
if ("script" == a.tagName.toLowerCase()) {
|
575
|
+
return null;
|
576
|
+
}
|
577
|
+
break;
|
578
|
+
case Node.TEXT_NODE:
|
579
|
+
a = axs.utils.parentElement(a);
|
580
|
+
break;
|
581
|
+
default:
|
582
|
+
return console.warn("Unhandled node type: ", a.nodeType), null;
|
583
|
+
}
|
584
|
+
return a;
|
585
|
+
};
|
586
|
+
axs.utils.elementIsTransparent = function(a) {
|
587
|
+
return "0" == a.style.opacity;
|
588
|
+
};
|
589
|
+
axs.utils.elementHasZeroArea = function(a) {
|
590
|
+
a = a.getBoundingClientRect();
|
591
|
+
var b = a.top - a.bottom;
|
592
|
+
return a.right - a.left && b ? !1 : !0;
|
593
|
+
};
|
594
|
+
axs.utils.elementIsOutsideScrollArea = function(a) {
|
595
|
+
for (var b = axs.utils.parentElement(a), c = a.ownerDocument.defaultView;b != c.document.body;) {
|
596
|
+
if (axs.utils.isClippedBy(a, b)) {
|
597
|
+
return !0;
|
598
|
+
}
|
599
|
+
if (axs.utils.canScrollTo(a, b) && !axs.utils.elementIsOutsideScrollArea(b)) {
|
600
|
+
return !1;
|
601
|
+
}
|
602
|
+
b = axs.utils.parentElement(b);
|
603
|
+
}
|
604
|
+
return !axs.utils.canScrollTo(a, c.document.body);
|
605
|
+
};
|
606
|
+
axs.utils.canScrollTo = function(a, b) {
|
607
|
+
var c = a.getBoundingClientRect(), d = b.getBoundingClientRect(), e = d.top, f = d.left, g = e - b.scrollTop, e = e - b.scrollTop + b.scrollHeight, h = f - b.scrollLeft + b.scrollWidth;
|
608
|
+
if (c.right < f - b.scrollLeft || c.bottom < g || c.left > h || c.top > e) {
|
609
|
+
return !1;
|
610
|
+
}
|
611
|
+
f = a.ownerDocument.defaultView;
|
612
|
+
g = f.getComputedStyle(b);
|
613
|
+
return c.left > d.right || c.top > d.bottom ? "scroll" == g.overflow || "auto" == g.overflow || b instanceof f.HTMLBodyElement : !0;
|
614
|
+
};
|
615
|
+
axs.utils.isClippedBy = function(a, b) {
|
616
|
+
var c = a.getBoundingClientRect(), d = b.getBoundingClientRect(), e = d.top - b.scrollTop, f = d.left - b.scrollLeft, g = a.ownerDocument.defaultView.getComputedStyle(b);
|
617
|
+
return (c.right < d.left || c.bottom < d.top || c.left > d.right || c.top > d.bottom) && "hidden" == g.overflow ? !0 : c.right < f || c.bottom < e ? "visible" != g.overflow : !1;
|
618
|
+
};
|
619
|
+
axs.utils.isAncestor = function(a, b) {
|
620
|
+
return null == b ? !1 : b === a ? !0 : axs.utils.isAncestor(a, b.parentNode);
|
621
|
+
};
|
622
|
+
axs.utils.overlappingElements = function(a) {
|
623
|
+
if (axs.utils.elementHasZeroArea(a)) {
|
624
|
+
return null;
|
625
|
+
}
|
626
|
+
for (var b = [], c = a.getClientRects(), d = 0;d < c.length;d++) {
|
627
|
+
var e = c[d], e = document.elementFromPoint((e.left + e.right) / 2, (e.top + e.bottom) / 2);
|
628
|
+
if (null != e && e != a && !axs.utils.isAncestor(e, a) && !axs.utils.isAncestor(a, e)) {
|
629
|
+
var f = window.getComputedStyle(e, null);
|
630
|
+
f && (f = axs.utils.getBgColor(f, e)) && 0 < f.alpha && 0 > b.indexOf(e) && b.push(e);
|
631
|
+
}
|
632
|
+
}
|
633
|
+
return b;
|
634
|
+
};
|
635
|
+
axs.utils.elementIsHtmlControl = function(a) {
|
636
|
+
var b = a.ownerDocument.defaultView;
|
637
|
+
return a instanceof b.HTMLButtonElement || a instanceof b.HTMLInputElement || a instanceof b.HTMLSelectElement || a instanceof b.HTMLTextAreaElement ? !0 : !1;
|
638
|
+
};
|
639
|
+
axs.utils.elementIsAriaWidget = function(a) {
|
640
|
+
return a.hasAttribute("role") && (a = a.getAttribute("role")) && (a = axs.constants.ARIA_ROLES[a]) && "widget" in a.allParentRolesSet ? !0 : !1;
|
641
|
+
};
|
642
|
+
axs.utils.elementIsVisible = function(a) {
|
643
|
+
return axs.utils.elementIsTransparent(a) || axs.utils.elementHasZeroArea(a) || axs.utils.elementIsOutsideScrollArea(a) || axs.utils.overlappingElements(a).length ? !1 : !0;
|
644
|
+
};
|
645
|
+
axs.utils.isLargeFont = function(a) {
|
646
|
+
var b = a.fontSize;
|
647
|
+
a = "bold" == a.fontWeight;
|
648
|
+
var c = b.match(/(\d+)px/);
|
649
|
+
if (c) {
|
650
|
+
b = parseInt(c[1], 10);
|
651
|
+
if (c = window.getComputedStyle(document.body, null).fontSize.match(/(\d+)px/)) {
|
652
|
+
var d = parseInt(c[1], 10), c = 1.2 * d, d = 1.5 * d
|
653
|
+
} else {
|
654
|
+
c = 19.2, d = 24;
|
655
|
+
}
|
656
|
+
return a && b >= c || b >= d;
|
657
|
+
}
|
658
|
+
if (c = b.match(/(\d+)em/)) {
|
659
|
+
return b = parseInt(c[1], 10), a && 1.2 <= b || 1.5 <= b ? !0 : !1;
|
660
|
+
}
|
661
|
+
if (c = b.match(/(\d+)%/)) {
|
662
|
+
return b = parseInt(c[1], 10), a && 120 <= b || 150 <= b ? !0 : !1;
|
663
|
+
}
|
664
|
+
if (c = b.match(/(\d+)pt/)) {
|
665
|
+
if (b = parseInt(c[1], 10), a && 14 <= b || 18 <= b) {
|
666
|
+
return !0;
|
667
|
+
}
|
668
|
+
}
|
669
|
+
return !1;
|
670
|
+
};
|
671
|
+
axs.utils.getBgColor = function(a, b) {
|
672
|
+
var c = axs.utils.parseColor(a.backgroundColor);
|
673
|
+
if (!c) {
|
674
|
+
return null;
|
675
|
+
}
|
676
|
+
1 > a.opacity && (c.alpha *= a.opacity);
|
677
|
+
if (1 > c.alpha) {
|
678
|
+
var d = axs.utils.getParentBgColor(b);
|
679
|
+
if (null == d) {
|
680
|
+
return null;
|
681
|
+
}
|
682
|
+
c = axs.utils.flattenColors(c, d);
|
683
|
+
}
|
684
|
+
return c;
|
685
|
+
};
|
686
|
+
axs.utils.getParentBgColor = function(a) {
|
687
|
+
var b = a;
|
688
|
+
a = [];
|
689
|
+
for (var c = null;b = axs.utils.parentElement(b);) {
|
690
|
+
var d = window.getComputedStyle(b, null);
|
691
|
+
if (d) {
|
692
|
+
var e = axs.utils.parseColor(d.backgroundColor);
|
693
|
+
if (e && (1 > d.opacity && (e.alpha *= d.opacity), 0 != e.alpha && (a.push(e), 1 == e.alpha))) {
|
694
|
+
c = !0;
|
695
|
+
break;
|
696
|
+
}
|
697
|
+
}
|
698
|
+
}
|
699
|
+
c || a.push(new axs.utils.Color(255, 255, 255, 1));
|
700
|
+
for (b = a.pop();a.length;) {
|
701
|
+
c = a.pop(), b = axs.utils.flattenColors(c, b);
|
702
|
+
}
|
703
|
+
return b;
|
704
|
+
};
|
705
|
+
axs.utils.getFgColor = function(a, b, c) {
|
706
|
+
var d = axs.utils.parseColor(a.color);
|
707
|
+
if (!d) {
|
708
|
+
return null;
|
709
|
+
}
|
710
|
+
1 > d.alpha && (d = axs.utils.flattenColors(d, c));
|
711
|
+
1 > a.opacity && (b = axs.utils.getParentBgColor(b), d.alpha *= a.opacity, d = axs.utils.flattenColors(d, b));
|
712
|
+
return d;
|
713
|
+
};
|
714
|
+
axs.utils.parseColor = function(a) {
|
715
|
+
var b = a.match(/^rgb\((\d+), (\d+), (\d+)\)$/);
|
716
|
+
if (b) {
|
717
|
+
a = parseInt(b[1], 10);
|
718
|
+
var c = parseInt(b[2], 10), d = parseInt(b[3], 10);
|
719
|
+
return new axs.utils.Color(a, c, d, 1);
|
720
|
+
}
|
721
|
+
return (b = a.match(/^rgba\((\d+), (\d+), (\d+), (\d*(\.\d+)?)\)/)) ? (a = parseInt(b[1], 10), c = parseInt(b[2], 10), d = parseInt(b[3], 10), b = parseFloat(b[4]), new axs.utils.Color(a, c, d, b)) : null;
|
722
|
+
};
|
723
|
+
axs.utils.colorChannelToString = function(a) {
|
724
|
+
a = Math.round(a);
|
725
|
+
return 15 >= a ? "0" + a.toString(16) : a.toString(16);
|
726
|
+
};
|
727
|
+
axs.utils.colorToString = function(a) {
|
728
|
+
return 1 == a.alpha ? "#" + axs.utils.colorChannelToString(a.red) + axs.utils.colorChannelToString(a.green) + axs.utils.colorChannelToString(a.blue) : "rgba(" + [a.red, a.green, a.blue, a.alpha].join() + ")";
|
729
|
+
};
|
730
|
+
axs.utils.luminanceFromContrastRatio = function(a, b, c) {
|
731
|
+
return c ? (a + .05) * b - .05 : (a + .05) / b - .05;
|
732
|
+
};
|
733
|
+
axs.utils.translateColor = function(a, b) {
|
734
|
+
var c = a[0], c = (b - c) / ((c > b ? 0 : 1) - c);
|
735
|
+
return axs.utils.fromYCC([b, a[1] - a[1] * c, a[2] - a[2] * c]);
|
736
|
+
};
|
737
|
+
axs.utils.suggestColors = function(a, b, c, d) {
|
738
|
+
if (!axs.utils.isLowContrast(c, d, !0)) {
|
739
|
+
return null;
|
740
|
+
}
|
741
|
+
var e = {}, f = axs.utils.calculateLuminance(a), g = axs.utils.calculateLuminance(b), h = axs.utils.isLargeFont(d) ? 3 : 4.5, k = axs.utils.isLargeFont(d) ? 4.5 : 7, m = g > f, l = axs.utils.luminanceFromContrastRatio(f, h + .02, m), n = axs.utils.luminanceFromContrastRatio(f, k + .02, m), p = axs.utils.toYCC(b);
|
742
|
+
if (axs.utils.isLowContrast(c, d, !1) && 1 >= l && 0 <= l) {
|
743
|
+
var q = axs.utils.translateColor(p, l), l = axs.utils.calculateContrastRatio(q, a), f = {};
|
744
|
+
f.fg = axs.utils.colorToString(q);
|
745
|
+
f.bg = axs.utils.colorToString(a);
|
746
|
+
f.contrast = l.toFixed(2);
|
747
|
+
e.AA = f;
|
748
|
+
}
|
749
|
+
axs.utils.isLowContrast(c, d, !0) && 1 >= n && 0 <= n && (n = axs.utils.translateColor(p, n), l = axs.utils.calculateContrastRatio(n, a), f = {}, f.fg = axs.utils.colorToString(n), f.bg = axs.utils.colorToString(a), f.contrast = l.toFixed(2), e.AAA = f);
|
750
|
+
h = axs.utils.luminanceFromContrastRatio(g, h + .02, !m);
|
751
|
+
g = axs.utils.luminanceFromContrastRatio(g, k + .02, !m);
|
752
|
+
a = axs.utils.toYCC(a);
|
753
|
+
!("AA" in e) && axs.utils.isLowContrast(c, d, !1) && 1 >= h && 0 <= h && (k = axs.utils.translateColor(a, h), l = axs.utils.calculateContrastRatio(b, k), f = {}, f.bg = axs.utils.colorToString(k), f.fg = axs.utils.colorToString(b), f.contrast = l.toFixed(2), e.AA = f);
|
754
|
+
!("AAA" in e) && axs.utils.isLowContrast(c, d, !0) && 1 >= g && 0 <= g && (c = axs.utils.translateColor(a, g), l = axs.utils.calculateContrastRatio(b, c), f = {}, f.bg = axs.utils.colorToString(c), f.fg = axs.utils.colorToString(b), f.contrast = l.toFixed(2), e.AAA = f);
|
755
|
+
return e;
|
756
|
+
};
|
757
|
+
axs.utils.flattenColors = function(a, b) {
|
758
|
+
var c = a.alpha;
|
759
|
+
return new axs.utils.Color((1 - c) * b.red + c * a.red, (1 - c) * b.green + c * a.green, (1 - c) * b.blue + c * a.blue, a.alpha + b.alpha * (1 - a.alpha));
|
760
|
+
};
|
761
|
+
axs.utils.calculateLuminance = function(a) {
|
762
|
+
return axs.utils.toYCC(a)[0];
|
763
|
+
};
|
764
|
+
axs.utils.RGBToYCCMatrix = function(a, b) {
|
765
|
+
return [[a, 1 - a - b, b], [-a / (2 - 2 * b), (a + b - 1) / (2 - 2 * b), (1 - b) / (2 - 2 * b)], [(1 - a) / (2 - 2 * a), (a + b - 1) / (2 - 2 * a), -b / (2 - 2 * a)]];
|
766
|
+
};
|
767
|
+
axs.utils.invert3x3Matrix = function(a) {
|
768
|
+
var b = a[0][0], c = a[0][1], d = a[0][2], e = a[1][0], f = a[1][1], g = a[1][2], h = a[2][0], k = a[2][1];
|
769
|
+
a = a[2][2];
|
770
|
+
return axs.utils.scalarMultiplyMatrix([[f * a - g * k, d * k - c * a, c * g - d * f], [g * h - e * a, b * a - d * h, d * e - b * g], [e * k - f * h, h * c - b * k, b * f - c * e]], 1 / (b * (f * a - g * k) - c * (a * e - g * h) + d * (e * k - f * h)));
|
771
|
+
};
|
772
|
+
axs.utils.scalarMultiplyMatrix = function(a, b) {
|
773
|
+
for (var c = [[], [], []], d = 0;3 > d;d++) {
|
774
|
+
for (var e = 0;3 > e;e++) {
|
775
|
+
c[d][e] = a[d][e] * b;
|
776
|
+
}
|
777
|
+
}
|
778
|
+
return c;
|
779
|
+
};
|
780
|
+
axs.utils.kR = .2126;
|
781
|
+
axs.utils.kB = .0722;
|
782
|
+
axs.utils.YCC_MATRIX = axs.utils.RGBToYCCMatrix(axs.utils.kR, axs.utils.kB);
|
783
|
+
axs.utils.INVERTED_YCC_MATRIX = axs.utils.invert3x3Matrix(axs.utils.YCC_MATRIX);
|
784
|
+
axs.utils.convertColor = function(a, b) {
|
785
|
+
var c = b[0], d = b[1], e = b[2];
|
786
|
+
return [a[0][0] * c + a[0][1] * d + a[0][2] * e, a[1][0] * c + a[1][1] * d + a[1][2] * e, a[2][0] * c + a[2][1] * d + a[2][2] * e];
|
787
|
+
};
|
788
|
+
axs.utils.multiplyMatrices = function(a, b) {
|
789
|
+
for (var c = [[], [], []], d = 0;3 > d;d++) {
|
790
|
+
for (var e = 0;3 > e;e++) {
|
791
|
+
c[d][e] = a[d][0] * b[0][e] + a[d][1] * b[1][e] + a[d][2] * b[2][e];
|
792
|
+
}
|
793
|
+
}
|
794
|
+
return c;
|
795
|
+
};
|
796
|
+
axs.utils.toYCC = function(a) {
|
797
|
+
var b = a.red / 255, c = a.green / 255;
|
798
|
+
a = a.blue / 255;
|
799
|
+
b = .03928 >= b ? b / 12.92 : Math.pow((b + .055) / 1.055, 2.4);
|
800
|
+
c = .03928 >= c ? c / 12.92 : Math.pow((c + .055) / 1.055, 2.4);
|
801
|
+
a = .03928 >= a ? a / 12.92 : Math.pow((a + .055) / 1.055, 2.4);
|
802
|
+
return axs.utils.convertColor(axs.utils.YCC_MATRIX, [b, c, a]);
|
803
|
+
};
|
804
|
+
axs.utils.fromYCC = function(a) {
|
805
|
+
var b = axs.utils.convertColor(axs.utils.INVERTED_YCC_MATRIX, a), c = b[0];
|
806
|
+
a = b[1];
|
807
|
+
b = b[2];
|
808
|
+
c = .00303949 >= c ? 12.92 * c : 1.055 * Math.pow(c, 1 / 2.4) - .055;
|
809
|
+
a = .00303949 >= a ? 12.92 * a : 1.055 * Math.pow(a, 1 / 2.4) - .055;
|
810
|
+
b = .00303949 >= b ? 12.92 * b : 1.055 * Math.pow(b, 1 / 2.4) - .055;
|
811
|
+
c = Math.min(Math.max(Math.round(255 * c), 0), 255);
|
812
|
+
a = Math.min(Math.max(Math.round(255 * a), 0), 255);
|
813
|
+
b = Math.min(Math.max(Math.round(255 * b), 0), 255);
|
814
|
+
return new axs.utils.Color(c, a, b, 1);
|
815
|
+
};
|
816
|
+
axs.utils.scalarMultiplyMatrix = function(a, b) {
|
817
|
+
for (var c = [[], [], []], d = 0;3 > d;d++) {
|
818
|
+
for (var e = 0;3 > e;e++) {
|
819
|
+
c[d][e] = a[d][e] * b;
|
820
|
+
}
|
821
|
+
}
|
822
|
+
return c;
|
823
|
+
};
|
824
|
+
axs.utils.multiplyMatrices = function(a, b) {
|
825
|
+
for (var c = [[], [], []], d = 0;3 > d;d++) {
|
826
|
+
for (var e = 0;3 > e;e++) {
|
827
|
+
c[d][e] = a[d][0] * b[0][e] + a[d][1] * b[1][e] + a[d][2] * b[2][e];
|
828
|
+
}
|
829
|
+
}
|
830
|
+
return c;
|
831
|
+
};
|
832
|
+
axs.utils.getContrastRatioForElement = function(a) {
|
833
|
+
var b = window.getComputedStyle(a, null);
|
834
|
+
return axs.utils.getContrastRatioForElementWithComputedStyle(b, a);
|
835
|
+
};
|
836
|
+
axs.utils.getContrastRatioForElementWithComputedStyle = function(a, b) {
|
837
|
+
if (axs.utils.isElementHidden(b)) {
|
838
|
+
return null;
|
839
|
+
}
|
840
|
+
var c = axs.utils.getBgColor(a, b);
|
841
|
+
if (!c) {
|
842
|
+
return null;
|
843
|
+
}
|
844
|
+
var d = axs.utils.getFgColor(a, b, c);
|
845
|
+
return d ? axs.utils.calculateContrastRatio(d, c) : null;
|
846
|
+
};
|
847
|
+
axs.utils.isNativeTextElement = function(a) {
|
848
|
+
var b = a.tagName.toLowerCase();
|
849
|
+
a = a.type ? a.type.toLowerCase() : "";
|
850
|
+
if ("textarea" == b) {
|
851
|
+
return !0;
|
852
|
+
}
|
853
|
+
if ("input" != b) {
|
854
|
+
return !1;
|
855
|
+
}
|
856
|
+
switch(a) {
|
857
|
+
case "email":
|
858
|
+
;
|
859
|
+
case "number":
|
860
|
+
;
|
861
|
+
case "password":
|
862
|
+
;
|
863
|
+
case "search":
|
864
|
+
;
|
865
|
+
case "text":
|
866
|
+
;
|
867
|
+
case "tel":
|
868
|
+
;
|
869
|
+
case "url":
|
870
|
+
;
|
871
|
+
case "":
|
872
|
+
return !0;
|
873
|
+
default:
|
874
|
+
return !1;
|
875
|
+
}
|
876
|
+
};
|
877
|
+
axs.utils.isLowContrast = function(a, b, c) {
|
878
|
+
a = Math.round(10 * a) / 10;
|
879
|
+
return c ? 4.5 > a || !axs.utils.isLargeFont(b) && 7 > a : 3 > a || !axs.utils.isLargeFont(b) && 4.5 > a;
|
880
|
+
};
|
881
|
+
axs.utils.hasLabel = function(a) {
|
882
|
+
var b = a.tagName.toLowerCase(), c = a.type ? a.type.toLowerCase() : "";
|
883
|
+
if (a.hasAttribute("aria-label") || a.hasAttribute("title") || "img" == b && a.hasAttribute("alt") || "input" == b && "image" == c && a.hasAttribute("alt") || "input" == b && ("submit" == c || "reset" == c) || a.hasAttribute("aria-labelledby") || a.hasAttribute("id") && 0 < document.querySelectorAll('label[for="' + a.id + '"]').length) {
|
884
|
+
return !0;
|
885
|
+
}
|
886
|
+
for (b = axs.utils.parentElement(a);b;) {
|
887
|
+
if ("label" == b.tagName.toLowerCase() && b.control == a) {
|
888
|
+
return !0;
|
889
|
+
}
|
890
|
+
b = axs.utils.parentElement(b);
|
891
|
+
}
|
892
|
+
return !1;
|
893
|
+
};
|
894
|
+
axs.utils.isElementHidden = function(a) {
|
895
|
+
if (!(a instanceof a.ownerDocument.defaultView.HTMLElement)) {
|
896
|
+
return !1;
|
897
|
+
}
|
898
|
+
if (a.hasAttribute("chromevoxignoreariahidden")) {
|
899
|
+
var b = !0
|
900
|
+
}
|
901
|
+
var c = window.getComputedStyle(a, null);
|
902
|
+
return "none" == c.display || "hidden" == c.visibility ? !0 : a.hasAttribute("aria-hidden") && "true" == a.getAttribute("aria-hidden").toLowerCase() ? !b : !1;
|
903
|
+
};
|
904
|
+
axs.utils.isElementOrAncestorHidden = function(a) {
|
905
|
+
return axs.utils.isElementHidden(a) ? !0 : axs.utils.parentElement(a) ? axs.utils.isElementOrAncestorHidden(axs.utils.parentElement(a)) : !1;
|
906
|
+
};
|
907
|
+
axs.utils.isInlineElement = function(a) {
|
908
|
+
a = a.tagName.toUpperCase();
|
909
|
+
return axs.constants.InlineElements[a];
|
910
|
+
};
|
911
|
+
axs.utils.getRoles = function(a, b) {
|
912
|
+
if (!a || a.nodeType !== Node.ELEMENT_NODE || !a.hasAttribute("role") && !b) {
|
913
|
+
return null;
|
914
|
+
}
|
915
|
+
var c = a.getAttribute("role");
|
916
|
+
!c && b && (c = axs.properties.getImplicitRole(a));
|
917
|
+
if (!c) {
|
918
|
+
return null;
|
919
|
+
}
|
920
|
+
for (var c = c.split(" "), d = [], e = !0, f = 0;f < c.length;f++) {
|
921
|
+
var g = c[f], h = axs.constants.ARIA_ROLES[g];
|
922
|
+
h && !h.abstract ? g = {name:g, details:axs.constants.ARIA_ROLES[g], valid:!0} : (g = {name:g, valid:!1}, e = !1);
|
923
|
+
d.push(g);
|
924
|
+
}
|
925
|
+
return {roles:d, valid:e};
|
926
|
+
};
|
927
|
+
axs.utils.getAriaPropertyValue = function(a, b, c) {
|
928
|
+
var d = a.replace(/^aria-/, ""), e = axs.constants.ARIA_PROPERTIES[d], d = {name:a, rawValue:b};
|
929
|
+
if (!e) {
|
930
|
+
return d.valid = !1, d.reason = '"' + a + '" is not a valid ARIA property', d;
|
931
|
+
}
|
932
|
+
e = e.valueType;
|
933
|
+
if (!e) {
|
934
|
+
return d.valid = !1, d.reason = '"' + a + '" is not a valid ARIA property', d;
|
935
|
+
}
|
936
|
+
switch(e) {
|
937
|
+
case "idref":
|
938
|
+
a = axs.utils.isValidIDRefValue(b, c), d.valid = a.valid, d.reason = a.reason, d.idref = a.idref;
|
939
|
+
case "idref_list":
|
940
|
+
a = b.split(/\s+/);
|
941
|
+
d.valid = !0;
|
942
|
+
for (b = 0;b < a.length;b++) {
|
943
|
+
e = axs.utils.isValidIDRefValue(a[b], c), e.valid || (d.valid = !1), d.values ? d.values.push(e) : d.values = [e];
|
944
|
+
}
|
945
|
+
return d;
|
946
|
+
case "integer":
|
947
|
+
;
|
948
|
+
case "decimal":
|
949
|
+
c = axs.utils.isValidNumber(b);
|
950
|
+
if (!c.valid) {
|
951
|
+
return d.valid = !1, d.reason = c.reason, d;
|
952
|
+
}
|
953
|
+
Math.floor(c.value) != c.value ? (d.valid = !1, d.reason = "" + b + " is not a whole integer") : (d.valid = !0, d.value = c.value);
|
954
|
+
return d;
|
955
|
+
case "number":
|
956
|
+
c = axs.utils.isValidNumber(b), c.valid && (d.valid = !0, d.value = c.value);
|
957
|
+
case "string":
|
958
|
+
return d.valid = !0, d.value = b, d;
|
959
|
+
case "token":
|
960
|
+
return c = axs.utils.isValidTokenValue(a, b.toLowerCase()), c.valid ? (d.valid = !0, d.value = c.value) : (d.valid = !1, d.value = b, d.reason = c.reason), d;
|
961
|
+
case "token_list":
|
962
|
+
e = b.split(/\s+/);
|
963
|
+
d.valid = !0;
|
964
|
+
for (b = 0;b < e.length;b++) {
|
965
|
+
c = axs.utils.isValidTokenValue(a, e[b].toLowerCase()), c.valid || (d.valid = !1, d.reason ? (d.reason = [d.reason], d.reason.push(c.reason)) : (d.reason = c.reason, d.possibleValues = c.possibleValues)), d.values ? d.values.push(c.value) : d.values = [c.value];
|
966
|
+
}
|
967
|
+
return d;
|
968
|
+
case "tristate":
|
969
|
+
return c = axs.utils.isPossibleValue(b.toLowerCase(), axs.constants.MIXED_VALUES, a), c.valid ? (d.valid = !0, d.value = c.value) : (d.valid = !1, d.value = b, d.reason = c.reason), d;
|
970
|
+
case "boolean":
|
971
|
+
return c = axs.utils.isValidBoolean(b), c.valid ? (d.valid = !0, d.value = c.value) : (d.valid = !1, d.value = b, d.reason = c.reason), d;
|
972
|
+
}
|
973
|
+
d.valid = !1;
|
974
|
+
d.reason = "Not a valid ARIA property";
|
975
|
+
return d;
|
976
|
+
};
|
977
|
+
axs.utils.isValidTokenValue = function(a, b) {
|
978
|
+
var c = a.replace(/^aria-/, "");
|
979
|
+
return axs.utils.isPossibleValue(b, axs.constants.ARIA_PROPERTIES[c].valuesSet, a);
|
980
|
+
};
|
981
|
+
axs.utils.isPossibleValue = function(a, b, c) {
|
982
|
+
return b[a] ? {valid:!0, value:a} : {valid:!1, value:a, reason:'"' + a + '" is not a valid value for ' + c, possibleValues:Object.keys(b)};
|
983
|
+
};
|
984
|
+
axs.utils.isValidBoolean = function(a) {
|
985
|
+
try {
|
986
|
+
var b = JSON.parse(a);
|
987
|
+
} catch (c) {
|
988
|
+
b = "";
|
989
|
+
}
|
990
|
+
return "boolean" != typeof b ? {valid:!1, value:a, reason:'"' + a + '" is not a true/false value'} : {valid:!0, value:b};
|
991
|
+
};
|
992
|
+
axs.utils.isValidIDRefValue = function(a, b) {
|
993
|
+
return 0 == a.length ? {valid:!0, idref:a} : b.ownerDocument.getElementById(a) ? {valid:!0, idref:a} : {valid:!1, idref:a, reason:'No element with ID "' + a + '"'};
|
994
|
+
};
|
995
|
+
axs.utils.isValidNumber = function(a) {
|
996
|
+
try {
|
997
|
+
var b = JSON.parse(a);
|
998
|
+
} catch (c) {
|
999
|
+
return {valid:!1, value:a, reason:'"' + a + '" is not a number'};
|
1000
|
+
}
|
1001
|
+
return "number" != typeof b ? {valid:!1, value:a, reason:'"' + a + '" is not a number'} : {valid:!0, value:b};
|
1002
|
+
};
|
1003
|
+
axs.utils.isElementImplicitlyFocusable = function(a) {
|
1004
|
+
var b = a.ownerDocument.defaultView;
|
1005
|
+
return a instanceof b.HTMLAnchorElement || a instanceof b.HTMLAreaElement ? a.hasAttribute("href") : a instanceof b.HTMLInputElement || a instanceof b.HTMLSelectElement || a instanceof b.HTMLTextAreaElement || a instanceof b.HTMLButtonElement || a instanceof b.HTMLIFrameElement ? !a.disabled : !1;
|
1006
|
+
};
|
1007
|
+
axs.utils.values = function(a) {
|
1008
|
+
var b = [], c;
|
1009
|
+
for (c in a) {
|
1010
|
+
a.hasOwnProperty(c) && "function" != typeof a[c] && b.push(a[c]);
|
1011
|
+
}
|
1012
|
+
return b;
|
1013
|
+
};
|
1014
|
+
axs.utils.namedValues = function(a) {
|
1015
|
+
var b = {}, c;
|
1016
|
+
for (c in a) {
|
1017
|
+
a.hasOwnProperty(c) && "function" != typeof a[c] && (b[c] = a[c]);
|
1018
|
+
}
|
1019
|
+
return b;
|
1020
|
+
};
|
1021
|
+
axs.utils.getQuerySelectorText = function(a) {
|
1022
|
+
if (null == a || "HTML" == a.tagName) {
|
1023
|
+
return "html";
|
1024
|
+
}
|
1025
|
+
if ("BODY" == a.tagName) {
|
1026
|
+
return "body";
|
1027
|
+
}
|
1028
|
+
if (a.hasAttribute) {
|
1029
|
+
if (a.id) {
|
1030
|
+
return "#" + a.id;
|
1031
|
+
}
|
1032
|
+
if (a.className) {
|
1033
|
+
for (var b = "", c = 0;c < a.classList.length;c++) {
|
1034
|
+
b += "." + a.classList[c];
|
1035
|
+
}
|
1036
|
+
var d = 0;
|
1037
|
+
if (a.parentNode) {
|
1038
|
+
for (c = 0;c < a.parentNode.children.length;c++) {
|
1039
|
+
var e = a.parentNode.children[c];
|
1040
|
+
axs.browserUtils.matchSelector(e, b) && d++;
|
1041
|
+
if (e === a) {
|
1042
|
+
break;
|
1043
|
+
}
|
1044
|
+
}
|
1045
|
+
} else {
|
1046
|
+
d = 1;
|
1047
|
+
}
|
1048
|
+
if (1 == d) {
|
1049
|
+
return axs.utils.getQuerySelectorText(a.parentNode) + " > " + b;
|
1050
|
+
}
|
1051
|
+
}
|
1052
|
+
if (a.parentNode) {
|
1053
|
+
b = a.parentNode.children;
|
1054
|
+
d = 1;
|
1055
|
+
for (c = 0;b[c] !== a;) {
|
1056
|
+
b[c].tagName == a.tagName && d++, c++;
|
1057
|
+
}
|
1058
|
+
c = "";
|
1059
|
+
"BODY" != a.parentNode.tagName && (c = axs.utils.getQuerySelectorText(a.parentNode) + " > ");
|
1060
|
+
return 1 == d ? c + a.tagName : c + a.tagName + ":nth-of-type(" + d + ")";
|
1061
|
+
}
|
1062
|
+
} else {
|
1063
|
+
if (a.selectorText) {
|
1064
|
+
return a.selectorText;
|
1065
|
+
}
|
1066
|
+
}
|
1067
|
+
return "";
|
1068
|
+
};
|
1069
|
+
axs.utils.getIdReferrers = function(a, b) {
|
1070
|
+
if (!b) {
|
1071
|
+
return null;
|
1072
|
+
}
|
1073
|
+
var c = b.id, d = a.replace(/^aria-/, ""), d = axs.constants.ARIA_PROPERTIES[d];
|
1074
|
+
if (!c || !d) {
|
1075
|
+
return null;
|
1076
|
+
}
|
1077
|
+
d = d.valueType;
|
1078
|
+
return "idref_list" === d || "idref" === d ? (c = c.replace(/'/g, "\\'"), b.ownerDocument.querySelectorAll("[" + a + "~='" + c + "']")) : null;
|
1079
|
+
};
|
1080
|
+
axs.utils.getIdReferents = function(a, b) {
|
1081
|
+
var c = [], d = a.replace(/^aria-/, ""), d = axs.constants.ARIA_PROPERTIES[d];
|
1082
|
+
if (!d || !b.hasAttribute(a)) {
|
1083
|
+
return c;
|
1084
|
+
}
|
1085
|
+
d = d.valueType;
|
1086
|
+
if ("idref_list" === d || "idref" === d) {
|
1087
|
+
for (var d = b.ownerDocument, e = b.getAttribute(a), e = e.split(/\s+/), f = 0, g = e.length;f < g;f++) {
|
1088
|
+
var h = d.getElementById(e[f]);
|
1089
|
+
h && (c[c.length] = h);
|
1090
|
+
}
|
1091
|
+
}
|
1092
|
+
return c;
|
1093
|
+
};
|
1094
|
+
axs.utils.getAriaPropertiesByValueType = function(a) {
|
1095
|
+
var b = {}, c;
|
1096
|
+
for (c in axs.constants.ARIA_PROPERTIES) {
|
1097
|
+
var d = axs.constants.ARIA_PROPERTIES[c];
|
1098
|
+
d && 0 <= a.indexOf(d.valueType) && (b[c] = d);
|
1099
|
+
}
|
1100
|
+
return b;
|
1101
|
+
};
|
1102
|
+
axs.utils.getSelectorForAriaProperties = function(a) {
|
1103
|
+
a = Object.keys(a).map(function(a) {
|
1104
|
+
return "[aria-" + a + "]";
|
1105
|
+
});
|
1106
|
+
a.sort();
|
1107
|
+
return a.join(",");
|
1108
|
+
};
|
1109
|
+
axs.utils.findDescendantsWithRole = function(a, b) {
|
1110
|
+
if (!a || !b) {
|
1111
|
+
return [];
|
1112
|
+
}
|
1113
|
+
var c = axs.properties.getSelectorForRole(b);
|
1114
|
+
if (c && (c = a.querySelectorAll(c))) {
|
1115
|
+
c = Array.prototype.map.call(c, function(a) {
|
1116
|
+
return a;
|
1117
|
+
});
|
1118
|
+
} else {
|
1119
|
+
return [];
|
1120
|
+
}
|
1121
|
+
return c;
|
1122
|
+
};
|
1123
|
+
axs.properties = {};
|
1124
|
+
axs.properties.TEXT_CONTENT_XPATH = './/text()[normalize-space(.)!=""]/parent::*[name()!="script"]';
|
1125
|
+
axs.properties.getFocusProperties = function(a) {
|
1126
|
+
var b = {}, c = a.getAttribute("tabindex");
|
1127
|
+
void 0 != c ? b.tabindex = {value:c, valid:!0} : axs.utils.isElementImplicitlyFocusable(a) && (b.implicitlyFocusable = {value:!0, valid:!0});
|
1128
|
+
if (0 == Object.keys(b).length) {
|
1129
|
+
return null;
|
1130
|
+
}
|
1131
|
+
var d = axs.utils.elementIsTransparent(a), e = axs.utils.elementHasZeroArea(a), f = axs.utils.elementIsOutsideScrollArea(a), g = axs.utils.overlappingElements(a);
|
1132
|
+
if (d || e || f || 0 < g.length) {
|
1133
|
+
var c = axs.utils.isElementOrAncestorHidden(a), h = {value:!1, valid:c};
|
1134
|
+
d && (h.transparent = !0);
|
1135
|
+
e && (h.zeroArea = !0);
|
1136
|
+
f && (h.outsideScrollArea = !0);
|
1137
|
+
g && 0 < g.length && (h.overlappingElements = g);
|
1138
|
+
d = {value:c, valid:c};
|
1139
|
+
c && (d.reason = axs.properties.getHiddenReason(a));
|
1140
|
+
h.hidden = d;
|
1141
|
+
b.visible = h;
|
1142
|
+
} else {
|
1143
|
+
b.visible = {value:!0, valid:!0};
|
1144
|
+
}
|
1145
|
+
return b;
|
1146
|
+
};
|
1147
|
+
axs.properties.getHiddenReason = function(a) {
|
1148
|
+
if (!(a && a instanceof a.ownerDocument.defaultView.HTMLElement)) {
|
1149
|
+
return null;
|
1150
|
+
}
|
1151
|
+
if (a.hasAttribute("chromevoxignoreariahidden")) {
|
1152
|
+
var b = !0
|
1153
|
+
}
|
1154
|
+
var c = window.getComputedStyle(a, null);
|
1155
|
+
return "none" == c.display ? {property:"display: none", on:a} : "hidden" == c.visibility ? {property:"visibility: hidden", on:a} : a.hasAttribute("aria-hidden") && "true" == a.getAttribute("aria-hidden").toLowerCase() && !b ? {property:"aria-hidden", on:a} : axs.properties.getHiddenReason(axs.utils.parentElement(a));
|
1156
|
+
};
|
1157
|
+
axs.properties.getColorProperties = function(a) {
|
1158
|
+
var b = {};
|
1159
|
+
(a = axs.properties.getContrastRatioProperties(a)) && (b.contrastRatio = a);
|
1160
|
+
return 0 == Object.keys(b).length ? null : b;
|
1161
|
+
};
|
1162
|
+
axs.properties.hasDirectTextDescendant = function(a) {
|
1163
|
+
function b() {
|
1164
|
+
for (var b = d.evaluate(axs.properties.TEXT_CONTENT_XPATH, a, null, XPathResult.ANY_TYPE, null), c = b.iterateNext();null != c;c = b.iterateNext()) {
|
1165
|
+
if (c === a) {
|
1166
|
+
return !0;
|
1167
|
+
}
|
1168
|
+
}
|
1169
|
+
return !1;
|
1170
|
+
}
|
1171
|
+
function c() {
|
1172
|
+
for (var b = d.createTreeWalker(a, NodeFilter.SHOW_TEXT, null, !1);b.nextNode();) {
|
1173
|
+
var c = b.currentNode, g = c.parentNode.tagName.toLowerCase();
|
1174
|
+
if (c.nodeValue.trim() && "script" !== g && a !== c) {
|
1175
|
+
return !0;
|
1176
|
+
}
|
1177
|
+
}
|
1178
|
+
return !1;
|
1179
|
+
}
|
1180
|
+
var d;
|
1181
|
+
d = a.nodeType == Node.DOCUMENT_NODE ? a : a.ownerDocument;
|
1182
|
+
return d.evaluate ? b() : c();
|
1183
|
+
};
|
1184
|
+
axs.properties.getContrastRatioProperties = function(a) {
|
1185
|
+
if (!axs.properties.hasDirectTextDescendant(a)) {
|
1186
|
+
return null;
|
1187
|
+
}
|
1188
|
+
var b = {}, c = window.getComputedStyle(a, null), d = axs.utils.getBgColor(c, a);
|
1189
|
+
if (!d) {
|
1190
|
+
return null;
|
1191
|
+
}
|
1192
|
+
b.backgroundColor = axs.utils.colorToString(d);
|
1193
|
+
var e = axs.utils.getFgColor(c, a, d);
|
1194
|
+
b.foregroundColor = axs.utils.colorToString(e);
|
1195
|
+
a = axs.utils.getContrastRatioForElementWithComputedStyle(c, a);
|
1196
|
+
if (!a) {
|
1197
|
+
return null;
|
1198
|
+
}
|
1199
|
+
b.value = a.toFixed(2);
|
1200
|
+
axs.utils.isLowContrast(a, c) && (b.alert = !0);
|
1201
|
+
(c = axs.utils.suggestColors(d, e, a, c)) && Object.keys(c).length && (b.suggestedColors = c);
|
1202
|
+
return b;
|
1203
|
+
};
|
1204
|
+
axs.properties.findTextAlternatives = function(a, b, c, d) {
|
1205
|
+
var e = c || !1;
|
1206
|
+
c = axs.utils.asElement(a);
|
1207
|
+
if (!c || !e && !d && axs.utils.isElementOrAncestorHidden(c)) {
|
1208
|
+
return null;
|
1209
|
+
}
|
1210
|
+
if (a.nodeType == Node.TEXT_NODE) {
|
1211
|
+
return c = {type:"text"}, c.text = a.textContent, c.lastWord = axs.properties.getLastWord(c.text), b.content = c, a.textContent;
|
1212
|
+
}
|
1213
|
+
a = null;
|
1214
|
+
e || (a = axs.properties.getTextFromAriaLabelledby(c, b));
|
1215
|
+
c.hasAttribute("aria-label") && (d = {type:"text"}, d.text = c.getAttribute("aria-label"), d.lastWord = axs.properties.getLastWord(d.text), a ? d.unused = !0 : e && axs.utils.elementIsHtmlControl(c) || (a = d.text), b.ariaLabel = d);
|
1216
|
+
c.hasAttribute("role") && "presentation" == c.getAttribute("role") || (a = axs.properties.getTextFromHostLanguageAttributes(c, b, a, e));
|
1217
|
+
if (e && axs.utils.elementIsHtmlControl(c)) {
|
1218
|
+
d = c.ownerDocument.defaultView;
|
1219
|
+
if (c instanceof d.HTMLInputElement) {
|
1220
|
+
var f = c;
|
1221
|
+
"text" == f.type && f.value && 0 < f.value.length && (b.controlValue = {text:f.value});
|
1222
|
+
"range" == f.type && (b.controlValue = {text:f.value});
|
1223
|
+
}
|
1224
|
+
c instanceof d.HTMLSelectElement && (b.controlValue = {text:c.value});
|
1225
|
+
b.controlValue && (d = b.controlValue, a ? d.unused = !0 : a = d.text);
|
1226
|
+
}
|
1227
|
+
if (e && axs.utils.elementIsAriaWidget(c)) {
|
1228
|
+
e = c.getAttribute("role");
|
1229
|
+
"textbox" == e && c.textContent && 0 < c.textContent.length && (b.controlValue = {text:c.textContent});
|
1230
|
+
if ("slider" == e || "spinbutton" == e) {
|
1231
|
+
c.hasAttribute("aria-valuetext") ? b.controlValue = {text:c.getAttribute("aria-valuetext")} : c.hasAttribute("aria-valuenow") && (b.controlValue = {value:c.getAttribute("aria-valuenow"), text:"" + c.getAttribute("aria-valuenow")});
|
1232
|
+
}
|
1233
|
+
if ("menu" == e) {
|
1234
|
+
var g = c.querySelectorAll("[role=menuitemcheckbox], [role=menuitemradio]");
|
1235
|
+
d = [];
|
1236
|
+
for (f = 0;f < g.length;f++) {
|
1237
|
+
"true" == g[f].getAttribute("aria-checked") && d.push(g[f]);
|
1238
|
+
}
|
1239
|
+
if (0 < d.length) {
|
1240
|
+
g = "";
|
1241
|
+
for (f = 0;f < d.length;f++) {
|
1242
|
+
g += axs.properties.findTextAlternatives(d[f], {}, !0), f < d.length - 1 && (g += ", ");
|
1243
|
+
}
|
1244
|
+
b.controlValue = {text:g};
|
1245
|
+
}
|
1246
|
+
}
|
1247
|
+
if ("combobox" == e || "select" == e) {
|
1248
|
+
b.controlValue = {text:"TODO"};
|
1249
|
+
}
|
1250
|
+
b.controlValue && (d = b.controlValue, a ? d.unused = !0 : a = d.text);
|
1251
|
+
}
|
1252
|
+
d = !0;
|
1253
|
+
c.hasAttribute("role") && (e = c.getAttribute("role"), (e = axs.constants.ARIA_ROLES[e]) && (!e.namefrom || 0 > e.namefrom.indexOf("contents")) && (d = !1));
|
1254
|
+
(e = axs.properties.getTextFromDescendantContent(c)) && d && (d = {type:"text"}, d.text = e, d.lastWord = axs.properties.getLastWord(d.text), a ? d.unused = !0 : a = e, b.content = d);
|
1255
|
+
c.hasAttribute("title") && (e = {type:"string", valid:!0}, e.text = c.getAttribute("title"), e.lastWord = axs.properties.getLastWord(e.lastWord), a ? e.unused = !0 : a = e.text, b.title = e);
|
1256
|
+
return 0 == Object.keys(b).length && null == a ? null : a;
|
1257
|
+
};
|
1258
|
+
axs.properties.getTextFromDescendantContent = function(a) {
|
1259
|
+
var b = a.childNodes;
|
1260
|
+
a = [];
|
1261
|
+
for (var c = 0;c < b.length;c++) {
|
1262
|
+
var d = axs.properties.findTextAlternatives(b[c], {}, !0);
|
1263
|
+
d && a.push(d.trim());
|
1264
|
+
}
|
1265
|
+
if (a.length) {
|
1266
|
+
b = "";
|
1267
|
+
for (c = 0;c < a.length;c++) {
|
1268
|
+
b = [b, a[c]].join(" ").trim();
|
1269
|
+
}
|
1270
|
+
return b;
|
1271
|
+
}
|
1272
|
+
return null;
|
1273
|
+
};
|
1274
|
+
axs.properties.getTextFromAriaLabelledby = function(a, b) {
|
1275
|
+
var c = null;
|
1276
|
+
if (!a.hasAttribute("aria-labelledby")) {
|
1277
|
+
return c;
|
1278
|
+
}
|
1279
|
+
for (var d = a.getAttribute("aria-labelledby").split(/\s+/), e = {valid:!0}, f = [], g = [], h = 0;h < d.length;h++) {
|
1280
|
+
var k = {type:"element"}, m = d[h];
|
1281
|
+
k.value = m;
|
1282
|
+
var l = document.getElementById(m);
|
1283
|
+
l ? (k.valid = !0, k.text = axs.properties.findTextAlternatives(l, {}, !0), k.lastWord = axs.properties.getLastWord(k.text), f.push(l.textContent.trim()), k.element = l) : (k.valid = !1, e.valid = !1, k.errorMessage = {messageKey:"noElementWithId", args:[m]});
|
1284
|
+
g.push(k);
|
1285
|
+
}
|
1286
|
+
0 < g.length && (g[g.length - 1].last = !0, e.values = g, e.text = f.join(" "), e.lastWord = axs.properties.getLastWord(e.text), c = e.text, b.ariaLabelledby = e);
|
1287
|
+
return c;
|
1288
|
+
};
|
1289
|
+
axs.properties.getTextFromHostLanguageAttributes = function(a, b, c, d) {
|
1290
|
+
if (axs.browserUtils.matchSelector(a, "img")) {
|
1291
|
+
if (a.hasAttribute("alt")) {
|
1292
|
+
var e = {type:"string", valid:!0};
|
1293
|
+
e.text = a.getAttribute("alt");
|
1294
|
+
c ? e.unused = !0 : c = e.text;
|
1295
|
+
b.alt = e;
|
1296
|
+
} else {
|
1297
|
+
e = {valid:!1, errorMessage:"No alt value provided"}, b.alt = e, e = a.src, "string" == typeof e && (c = e.split("/").pop(), b.filename = {text:c});
|
1298
|
+
}
|
1299
|
+
}
|
1300
|
+
if (axs.browserUtils.matchSelector(a, 'input:not([type="hidden"]):not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), video:not([disabled])') && !d) {
|
1301
|
+
if (a.hasAttribute("id")) {
|
1302
|
+
d = document.querySelectorAll('label[for="' + a.id + '"]');
|
1303
|
+
for (var e = {}, f = [], g = [], h = 0;h < d.length;h++) {
|
1304
|
+
var k = {type:"element"}, m = d[h], l = axs.properties.findTextAlternatives(m, {}, !0);
|
1305
|
+
l && 0 < l.trim().length && (k.text = l.trim(), g.push(l.trim()));
|
1306
|
+
k.element = m;
|
1307
|
+
f.push(k);
|
1308
|
+
}
|
1309
|
+
0 < f.length && (f[f.length - 1].last = !0, e.values = f, e.text = g.join(" "), e.lastWord = axs.properties.getLastWord(e.text), c ? e.unused = !0 : c = e.text, b.labelFor = e);
|
1310
|
+
}
|
1311
|
+
d = axs.utils.parentElement(a);
|
1312
|
+
for (e = {};d;) {
|
1313
|
+
if ("label" == d.tagName.toLowerCase() && (f = d, f.control == a)) {
|
1314
|
+
e.type = "element";
|
1315
|
+
e.text = axs.properties.findTextAlternatives(f, {}, !0);
|
1316
|
+
e.lastWord = axs.properties.getLastWord(e.text);
|
1317
|
+
e.element = f;
|
1318
|
+
break;
|
1319
|
+
}
|
1320
|
+
d = axs.utils.parentElement(d);
|
1321
|
+
}
|
1322
|
+
e.text && (c ? e.unused = !0 : c = e.text, b.labelWrapped = e);
|
1323
|
+
Object.keys(b).length || (b.noLabel = !0);
|
1324
|
+
}
|
1325
|
+
return c;
|
1326
|
+
};
|
1327
|
+
axs.properties.getLastWord = function(a) {
|
1328
|
+
if (!a) {
|
1329
|
+
return null;
|
1330
|
+
}
|
1331
|
+
var b = a.lastIndexOf(" ") + 1, c = a.length - 10;
|
1332
|
+
return a.substring(b > c ? b : c);
|
1333
|
+
};
|
1334
|
+
axs.properties.getTextProperties = function(a) {
|
1335
|
+
var b = {};
|
1336
|
+
a = axs.properties.findTextAlternatives(a, b, !1, !0);
|
1337
|
+
if (0 == Object.keys(b).length) {
|
1338
|
+
if (!a) {
|
1339
|
+
return null;
|
1340
|
+
}
|
1341
|
+
b.hasProperties = !1;
|
1342
|
+
} else {
|
1343
|
+
b.hasProperties = !0;
|
1344
|
+
}
|
1345
|
+
b.computedText = a;
|
1346
|
+
b.lastWord = axs.properties.getLastWord(a);
|
1347
|
+
return b;
|
1348
|
+
};
|
1349
|
+
axs.properties.getAriaProperties = function(a) {
|
1350
|
+
var b = {}, c = axs.properties.getGlobalAriaProperties(a), d;
|
1351
|
+
for (d in axs.constants.ARIA_PROPERTIES) {
|
1352
|
+
var e = "aria-" + d;
|
1353
|
+
if (a.hasAttribute(e)) {
|
1354
|
+
var f = a.getAttribute(e);
|
1355
|
+
c[e] = axs.utils.getAriaPropertyValue(e, f, a);
|
1356
|
+
}
|
1357
|
+
}
|
1358
|
+
0 < Object.keys(c).length && (b.properties = axs.utils.values(c));
|
1359
|
+
f = axs.utils.getRoles(a);
|
1360
|
+
if (!f) {
|
1361
|
+
return Object.keys(b).length ? b : null;
|
1362
|
+
}
|
1363
|
+
b.roles = f;
|
1364
|
+
if (!f.valid || !f.roles) {
|
1365
|
+
return b;
|
1366
|
+
}
|
1367
|
+
for (var e = f.roles, g = 0;g < e.length;g++) {
|
1368
|
+
var h = e[g];
|
1369
|
+
if (h.details && h.details.propertiesSet) {
|
1370
|
+
for (d in h.details.propertiesSet) {
|
1371
|
+
d in c || (a.hasAttribute(d) ? (f = a.getAttribute(d), c[d] = axs.utils.getAriaPropertyValue(d, f, a), "values" in c[d] && (f = c[d].values, f[f.length - 1].isLast = !0)) : h.details.requiredPropertiesSet[d] && (c[d] = {name:d, valid:!1, reason:"Required property not set"}));
|
1372
|
+
}
|
1373
|
+
}
|
1374
|
+
}
|
1375
|
+
0 < Object.keys(c).length && (b.properties = axs.utils.values(c));
|
1376
|
+
return 0 < Object.keys(b).length ? b : null;
|
1377
|
+
};
|
1378
|
+
axs.properties.getGlobalAriaProperties = function(a) {
|
1379
|
+
for (var b = {}, c = 0;c < axs.constants.GLOBAL_PROPERTIES.length;c++) {
|
1380
|
+
var d = axs.constants.GLOBAL_PROPERTIES[c];
|
1381
|
+
if (a.hasAttribute(d)) {
|
1382
|
+
var e = a.getAttribute(d);
|
1383
|
+
b[d] = axs.utils.getAriaPropertyValue(d, e, a);
|
1384
|
+
}
|
1385
|
+
}
|
1386
|
+
return b;
|
1387
|
+
};
|
1388
|
+
axs.properties.getVideoProperties = function(a) {
|
1389
|
+
if (!axs.browserUtils.matchSelector(a, "video")) {
|
1390
|
+
return null;
|
1391
|
+
}
|
1392
|
+
var b = {};
|
1393
|
+
b.captionTracks = axs.properties.getTrackElements(a, "captions");
|
1394
|
+
b.descriptionTracks = axs.properties.getTrackElements(a, "descriptions");
|
1395
|
+
b.chapterTracks = axs.properties.getTrackElements(a, "chapters");
|
1396
|
+
return b;
|
1397
|
+
};
|
1398
|
+
axs.properties.getTrackElements = function(a, b) {
|
1399
|
+
var c = a.querySelectorAll("track[kind=" + b + "]"), d = {};
|
1400
|
+
if (!c.length) {
|
1401
|
+
return d.valid = !1, d.reason = {messageKey:"noTracksProvided", args:[[b]]}, d;
|
1402
|
+
}
|
1403
|
+
d.valid = !0;
|
1404
|
+
for (var e = [], f = 0;f < c.length;f++) {
|
1405
|
+
var g = {}, h = c[f].getAttribute("src"), k = c[f].getAttribute("srcLang"), m = c[f].getAttribute("label");
|
1406
|
+
h ? (g.valid = !0, g.src = h) : (g.valid = !1, g.reason = {messageKey:"noSrcProvided"});
|
1407
|
+
h = "";
|
1408
|
+
m && (h += m, k && (h += " "));
|
1409
|
+
k && (h += "(" + k + ")");
|
1410
|
+
"" == h && (h = "[[object Object]]");
|
1411
|
+
g.name = h;
|
1412
|
+
e.push(g);
|
1413
|
+
}
|
1414
|
+
d.values = e;
|
1415
|
+
return d;
|
1416
|
+
};
|
1417
|
+
axs.properties.getAllProperties = function(a) {
|
1418
|
+
var b = axs.utils.asElement(a);
|
1419
|
+
if (!b) {
|
1420
|
+
return {};
|
1421
|
+
}
|
1422
|
+
var c = {};
|
1423
|
+
c.ariaProperties = axs.properties.getAriaProperties(b);
|
1424
|
+
c.colorProperties = axs.properties.getColorProperties(b);
|
1425
|
+
c.focusProperties = axs.properties.getFocusProperties(b);
|
1426
|
+
c.textProperties = axs.properties.getTextProperties(a);
|
1427
|
+
c.videoProperties = axs.properties.getVideoProperties(b);
|
1428
|
+
return c;
|
1429
|
+
};
|
1430
|
+
(function() {
|
1431
|
+
function a(a) {
|
1432
|
+
if (!a) {
|
1433
|
+
return null;
|
1434
|
+
}
|
1435
|
+
var c = a.tagName;
|
1436
|
+
if (!c) {
|
1437
|
+
return null;
|
1438
|
+
}
|
1439
|
+
c = c.toUpperCase();
|
1440
|
+
c = axs.constants.TAG_TO_IMPLICIT_SEMANTIC_INFO[c];
|
1441
|
+
if (!c || !c.length) {
|
1442
|
+
return null;
|
1443
|
+
}
|
1444
|
+
for (var d = null, e = 0, f = c.length;e < f;e++) {
|
1445
|
+
var g = c[e];
|
1446
|
+
if (g.selector) {
|
1447
|
+
if (axs.browserUtils.matchSelector(a, g.selector)) {
|
1448
|
+
return g;
|
1449
|
+
}
|
1450
|
+
} else {
|
1451
|
+
d = g;
|
1452
|
+
}
|
1453
|
+
}
|
1454
|
+
return d;
|
1455
|
+
}
|
1456
|
+
axs.properties.getImplicitRole = function(b) {
|
1457
|
+
return (b = a(b)) ? b.role : "";
|
1458
|
+
};
|
1459
|
+
axs.properties.canTakeAriaAttributes = function(b) {
|
1460
|
+
return (b = a(b)) ? !b.reserved : !0;
|
1461
|
+
};
|
1462
|
+
})();
|
1463
|
+
axs.properties.getNativelySupportedAttributes = function(a) {
|
1464
|
+
var b = [];
|
1465
|
+
if (!a) {
|
1466
|
+
return b;
|
1467
|
+
}
|
1468
|
+
a = a.cloneNode(!1);
|
1469
|
+
for (var c = Object.keys(axs.constants.ARIA_TO_HTML_ATTRIBUTE), d = 0;d < c.length;d++) {
|
1470
|
+
var e = c[d];
|
1471
|
+
axs.constants.ARIA_TO_HTML_ATTRIBUTE[e] in a && (b[b.length] = e);
|
1472
|
+
}
|
1473
|
+
return b;
|
1474
|
+
};
|
1475
|
+
(function() {
|
1476
|
+
var a = {};
|
1477
|
+
axs.properties.getSelectorForRole = function(b) {
|
1478
|
+
if (!b) {
|
1479
|
+
return "";
|
1480
|
+
}
|
1481
|
+
if (a[b] && a.hasOwnProperty(b)) {
|
1482
|
+
return a[b];
|
1483
|
+
}
|
1484
|
+
var c = ['[role="' + b + '"]'];
|
1485
|
+
Object.keys(axs.constants.TAG_TO_IMPLICIT_SEMANTIC_INFO).forEach(function(a) {
|
1486
|
+
var e = axs.constants.TAG_TO_IMPLICIT_SEMANTIC_INFO[a];
|
1487
|
+
if (e && e.length) {
|
1488
|
+
for (var f = 0;f < e.length;f++) {
|
1489
|
+
var g = e[f];
|
1490
|
+
if (g.role === b) {
|
1491
|
+
if (g.selector) {
|
1492
|
+
c[c.length] = g.selector;
|
1493
|
+
} else {
|
1494
|
+
c[c.length] = a;
|
1495
|
+
break;
|
1496
|
+
}
|
1497
|
+
}
|
1498
|
+
}
|
1499
|
+
}
|
1500
|
+
});
|
1501
|
+
return a[b] = c.join(",");
|
1502
|
+
};
|
1503
|
+
})();
|
1504
|
+
axs.AuditRule = function(a) {
|
1505
|
+
for (var b = !0, c = [], d = 0;d < axs.AuditRule.requiredFields.length;d++) {
|
1506
|
+
var e = axs.AuditRule.requiredFields[d];
|
1507
|
+
e in a || (b = !1, c.push(e));
|
1508
|
+
}
|
1509
|
+
if (!b) {
|
1510
|
+
throw "Invalid spec; the following fields were not specified: " + c.join(", ") + "\n" + JSON.stringify(a);
|
1511
|
+
}
|
1512
|
+
this.name = a.name;
|
1513
|
+
this.severity = a.severity;
|
1514
|
+
this.relevantElementMatcher_ = a.relevantElementMatcher;
|
1515
|
+
this.test_ = a.test;
|
1516
|
+
this.code = a.code;
|
1517
|
+
this.heading = a.heading || "";
|
1518
|
+
this.url = a.url || "";
|
1519
|
+
this.requiresConsoleAPI = !!a.opt_requiresConsoleAPI;
|
1520
|
+
};
|
1521
|
+
axs.AuditRule.requiredFields = "name severity relevantElementMatcher test code heading".split(" ");
|
1522
|
+
axs.AuditRule.NOT_APPLICABLE = {result:axs.constants.AuditResult.NA};
|
1523
|
+
axs.AuditRule.prototype.addElement = function(a, b) {
|
1524
|
+
a.push(b);
|
1525
|
+
};
|
1526
|
+
axs.AuditRule.collectMatchingElements = function(a, b, c, d) {
|
1527
|
+
if (a.nodeType == Node.ELEMENT_NODE) {
|
1528
|
+
var e = a
|
1529
|
+
}
|
1530
|
+
e && b.call(null, e) && c.push(e);
|
1531
|
+
if (e) {
|
1532
|
+
var f = e.shadowRoot || e.webkitShadowRoot;
|
1533
|
+
if (f) {
|
1534
|
+
axs.AuditRule.collectMatchingElements(f, b, c, f);
|
1535
|
+
return;
|
1536
|
+
}
|
1537
|
+
}
|
1538
|
+
if (e && "content" == e.localName) {
|
1539
|
+
for (e = e.getDistributedNodes(), f = 0;f < e.length;f++) {
|
1540
|
+
axs.AuditRule.collectMatchingElements(e[f], b, c, d);
|
1541
|
+
}
|
1542
|
+
} else {
|
1543
|
+
if (e && "shadow" == e.localName) {
|
1544
|
+
if (f = e, d) {
|
1545
|
+
for (e = f.getDistributedNodes(), f = 0;f < e.length;f++) {
|
1546
|
+
axs.AuditRule.collectMatchingElements(e[f], b, c, d);
|
1547
|
+
}
|
1548
|
+
} else {
|
1549
|
+
console.warn("ShadowRoot not provided for", e);
|
1550
|
+
}
|
1551
|
+
}
|
1552
|
+
for (a = a.firstChild;null != a;) {
|
1553
|
+
axs.AuditRule.collectMatchingElements(a, b, c, d), a = a.nextSibling;
|
1554
|
+
}
|
1555
|
+
}
|
1556
|
+
};
|
1557
|
+
axs.AuditRule.prototype.run = function(a) {
|
1558
|
+
a = a || {};
|
1559
|
+
var b = "ignoreSelectors" in a ? a.ignoreSelectors : [], c = "maxResults" in a ? a.maxResults : null, d = [];
|
1560
|
+
axs.AuditRule.collectMatchingElements("scope" in a ? a.scope : document, this.relevantElementMatcher_, d);
|
1561
|
+
var e = [];
|
1562
|
+
if (!d.length) {
|
1563
|
+
return {result:axs.constants.AuditResult.NA};
|
1564
|
+
}
|
1565
|
+
for (var f = 0;f < d.length && !(null != c && e.length >= c);f++) {
|
1566
|
+
var g = d[f], h;
|
1567
|
+
a: {
|
1568
|
+
h = g;
|
1569
|
+
for (var k = 0;k < b.length;k++) {
|
1570
|
+
if (axs.browserUtils.matchSelector(h, b[k])) {
|
1571
|
+
h = !0;
|
1572
|
+
break a;
|
1573
|
+
}
|
1574
|
+
}
|
1575
|
+
h = !1;
|
1576
|
+
}
|
1577
|
+
!h && this.test_(g, a.config) && this.addElement(e, g);
|
1578
|
+
}
|
1579
|
+
a = {result:e.length ? axs.constants.AuditResult.FAIL : axs.constants.AuditResult.PASS, elements:e};
|
1580
|
+
f < d.length && (a.resultsTruncated = !0);
|
1581
|
+
return a;
|
1582
|
+
};
|
1583
|
+
axs.AuditRules = {};
|
1584
|
+
(function() {
|
1585
|
+
var a = {}, b = {};
|
1586
|
+
axs.AuditRules.addRule = function(c) {
|
1587
|
+
c = new axs.AuditRule(c);
|
1588
|
+
if (c.code in b) {
|
1589
|
+
throw Error('Can not add audit rule with same code: "' + c.code + '"');
|
1590
|
+
}
|
1591
|
+
if (c.name in a) {
|
1592
|
+
throw Error('Can not add audit rule with same name: "' + c.name + '"');
|
1593
|
+
}
|
1594
|
+
a[c.name] = b[c.code] = c;
|
1595
|
+
};
|
1596
|
+
axs.AuditRules.getRule = function(c) {
|
1597
|
+
return a[c] || b[c] || null;
|
1598
|
+
};
|
1599
|
+
axs.AuditRules.getRules = function(b) {
|
1600
|
+
var d = Object.keys(a);
|
1601
|
+
return b ? d : d.map(function(a) {
|
1602
|
+
return this.getRule(a);
|
1603
|
+
}, axs.AuditRules);
|
1604
|
+
};
|
1605
|
+
})();
|
1606
|
+
axs.AuditResults = function() {
|
1607
|
+
this.errors_ = [];
|
1608
|
+
this.warnings_ = [];
|
1609
|
+
};
|
1610
|
+
goog.exportSymbol("axs.AuditResults", axs.AuditResults);
|
1611
|
+
axs.AuditResults.prototype.addError = function(a) {
|
1612
|
+
"" != a && this.errors_.push(a);
|
1613
|
+
};
|
1614
|
+
goog.exportProperty(axs.AuditResults.prototype, "addError", axs.AuditResults.prototype.addError);
|
1615
|
+
axs.AuditResults.prototype.addWarning = function(a) {
|
1616
|
+
"" != a && this.warnings_.push(a);
|
1617
|
+
};
|
1618
|
+
goog.exportProperty(axs.AuditResults.prototype, "addWarning", axs.AuditResults.prototype.addWarning);
|
1619
|
+
axs.AuditResults.prototype.numErrors = function() {
|
1620
|
+
return this.errors_.length;
|
1621
|
+
};
|
1622
|
+
goog.exportProperty(axs.AuditResults.prototype, "numErrors", axs.AuditResults.prototype.numErrors);
|
1623
|
+
axs.AuditResults.prototype.numWarnings = function() {
|
1624
|
+
return this.warnings_.length;
|
1625
|
+
};
|
1626
|
+
goog.exportProperty(axs.AuditResults.prototype, "numWarnings", axs.AuditResults.prototype.numWarnings);
|
1627
|
+
axs.AuditResults.prototype.getErrors = function() {
|
1628
|
+
return this.errors_;
|
1629
|
+
};
|
1630
|
+
goog.exportProperty(axs.AuditResults.prototype, "getErrors", axs.AuditResults.prototype.getErrors);
|
1631
|
+
axs.AuditResults.prototype.getWarnings = function() {
|
1632
|
+
return this.warnings_;
|
1633
|
+
};
|
1634
|
+
goog.exportProperty(axs.AuditResults.prototype, "getWarnings", axs.AuditResults.prototype.getWarnings);
|
1635
|
+
axs.AuditResults.prototype.toString = function() {
|
1636
|
+
for (var a = "", b = 0;b < this.errors_.length;b++) {
|
1637
|
+
0 == b && (a += "\nErrors:\n");
|
1638
|
+
var c = this.errors_[b], a = a + (c + "\n\n");
|
1639
|
+
}
|
1640
|
+
for (b = 0;b < this.warnings_.length;b++) {
|
1641
|
+
0 == b && (a += "\nWarnings:\n"), c = this.warnings_[b], a += c + "\n\n";
|
1642
|
+
}
|
1643
|
+
return a;
|
1644
|
+
};
|
1645
|
+
goog.exportProperty(axs.AuditResults.prototype, "toString", axs.AuditResults.prototype.toString);
|
1646
|
+
axs.Audit = {};
|
1647
|
+
axs.AuditConfiguration = function() {
|
1648
|
+
this.rules_ = {};
|
1649
|
+
this.maxResults = this.auditRulesToIgnore = this.auditRulesToRun = this.scope = null;
|
1650
|
+
this.withConsoleApi = !1;
|
1651
|
+
this.showUnsupportedRulesWarning = !0;
|
1652
|
+
goog.exportProperty(this, "scope", this.scope);
|
1653
|
+
goog.exportProperty(this, "auditRulesToRun", this.auditRulesToRun);
|
1654
|
+
goog.exportProperty(this, "auditRulesToIgnore", this.auditRulesToIgnore);
|
1655
|
+
goog.exportProperty(this, "withConsoleApi", this.withConsoleApi);
|
1656
|
+
goog.exportProperty(this, "showUnsupportedRulesWarning", this.showUnsupportedRulesWarning);
|
1657
|
+
};
|
1658
|
+
goog.exportSymbol("axs.AuditConfiguration", axs.AuditConfiguration);
|
1659
|
+
axs.AuditConfiguration.prototype = {ignoreSelectors:function(a, b) {
|
1660
|
+
a in this.rules_ || (this.rules_[a] = {});
|
1661
|
+
"ignore" in this.rules_[a] || (this.rules_[a].ignore = []);
|
1662
|
+
Array.prototype.push.call(this.rules_[a].ignore, b);
|
1663
|
+
}, getIgnoreSelectors:function(a) {
|
1664
|
+
return a in this.rules_ && "ignore" in this.rules_[a] ? this.rules_[a].ignore : [];
|
1665
|
+
}, setSeverity:function(a, b) {
|
1666
|
+
a in this.rules_ || (this.rules_[a] = {});
|
1667
|
+
this.rules_[a].severity = b;
|
1668
|
+
}, getSeverity:function(a) {
|
1669
|
+
return a in this.rules_ && "severity" in this.rules_[a] ? this.rules_[a].severity : null;
|
1670
|
+
}, setRuleConfig:function(a, b) {
|
1671
|
+
a in this.rules_ || (this.rules_[a] = {});
|
1672
|
+
this.rules_[a].config = b;
|
1673
|
+
}, getRuleConfig:function(a) {
|
1674
|
+
return a in this.rules_ && "config" in this.rules_[a] ? this.rules_[a].config : null;
|
1675
|
+
}};
|
1676
|
+
goog.exportProperty(axs.AuditConfiguration.prototype, "ignoreSelectors", axs.AuditConfiguration.prototype.ignoreSelectors);
|
1677
|
+
goog.exportProperty(axs.AuditConfiguration.prototype, "getIgnoreSelectors", axs.AuditConfiguration.prototype.getIgnoreSelectors);
|
1678
|
+
axs.Audit.unsupportedRulesWarningShown = !1;
|
1679
|
+
axs.Audit.getRulesCannotRun = function(a) {
|
1680
|
+
return a.withConsoleApi ? [] : axs.AuditRules.getRules().filter(function(a) {
|
1681
|
+
return a.requiresConsoleAPI;
|
1682
|
+
}).map(function(a) {
|
1683
|
+
return a.code;
|
1684
|
+
});
|
1685
|
+
};
|
1686
|
+
axs.Audit.run = function(a) {
|
1687
|
+
a = a || new axs.AuditConfiguration;
|
1688
|
+
var b = a.withConsoleApi, c = [], d;
|
1689
|
+
d = a.auditRulesToRun && 0 < a.auditRulesToRun.length ? a.auditRulesToRun : axs.AuditRules.getRules(!0);
|
1690
|
+
if (a.auditRulesToIgnore) {
|
1691
|
+
for (var e = 0;e < a.auditRulesToIgnore.length;e++) {
|
1692
|
+
var f = a.auditRulesToIgnore[e];
|
1693
|
+
0 > d.indexOf(f) || d.splice(d.indexOf(f), 1);
|
1694
|
+
}
|
1695
|
+
}
|
1696
|
+
!axs.Audit.unsupportedRulesWarningShown && a.showUnsupportedRulesWarning && (e = axs.Audit.getRulesCannotRun(a), 0 < e.length && (console.warn("Some rules cannot be checked using the axs.Audit.run() method call. Use the Chrome plugin to check these rules: " + e.join(", ")), console.warn("To remove this message, pass an AuditConfiguration object to axs.Audit.run() and set configuration.showUnsupportedRulesWarning = false.")), axs.Audit.unsupportedRulesWarningShown = !0);
|
1697
|
+
for (e = 0;e < d.length;e++) {
|
1698
|
+
var f = d[e], g = axs.AuditRules.getRule(f);
|
1699
|
+
if (g && !g.disabled && (b || !g.requiresConsoleAPI)) {
|
1700
|
+
var h = {}, k = a.getIgnoreSelectors(g.name);
|
1701
|
+
if (0 < k.length || a.scope) {
|
1702
|
+
h.ignoreSelectors = k;
|
1703
|
+
}
|
1704
|
+
k = a.getRuleConfig(g.name);
|
1705
|
+
null != k && (h.config = k);
|
1706
|
+
a.scope && (h.scope = a.scope);
|
1707
|
+
a.maxResults && (h.maxResults = a.maxResults);
|
1708
|
+
h = g.run.call(g, h);
|
1709
|
+
g = axs.utils.namedValues(g);
|
1710
|
+
g.severity = a.getSeverity(f) || g.severity;
|
1711
|
+
h.rule = g;
|
1712
|
+
c.push(h);
|
1713
|
+
}
|
1714
|
+
}
|
1715
|
+
return c;
|
1716
|
+
};
|
1717
|
+
goog.exportSymbol("axs.Audit.run", axs.Audit.run);
|
1718
|
+
axs.Audit.auditResults = function(a) {
|
1719
|
+
for (var b = new axs.AuditResults, c = 0;c < a.length;c++) {
|
1720
|
+
var d = a[c];
|
1721
|
+
d.result == axs.constants.AuditResult.FAIL && (d.rule.severity == axs.constants.Severity.SEVERE ? b.addError(axs.Audit.accessibilityErrorMessage(d)) : b.addWarning(axs.Audit.accessibilityErrorMessage(d)));
|
1722
|
+
}
|
1723
|
+
return b;
|
1724
|
+
};
|
1725
|
+
goog.exportSymbol("axs.Audit.auditResults", axs.Audit.auditResults);
|
1726
|
+
axs.Audit.createReport = function(a, b) {
|
1727
|
+
var c;
|
1728
|
+
c = "*** Begin accessibility audit results ***\nAn accessibility audit found " + axs.Audit.auditResults(a).toString();
|
1729
|
+
b && (c += "\nFor more information, please see ", c += b);
|
1730
|
+
return c += "\n*** End accessibility audit results ***";
|
1731
|
+
};
|
1732
|
+
goog.exportSymbol("axs.Audit.createReport", axs.Audit.createReport);
|
1733
|
+
axs.Audit.accessibilityErrorMessage = function(a) {
|
1734
|
+
for (var b = a.rule.severity == axs.constants.Severity.SEVERE ? "Error: " : "Warning: ", b = b + (a.rule.code + " (" + a.rule.heading + ") failed on the following " + (1 == a.elements.length ? "element" : "elements")), b = 1 == a.elements.length ? b + ":" : b + (" (1 - " + Math.min(5, a.elements.length) + " of " + a.elements.length + "):"), c = Math.min(a.elements.length, 5), d = 0;d < c;d++) {
|
1735
|
+
var e = a.elements[d], b = b + "\n";
|
1736
|
+
try {
|
1737
|
+
b += axs.utils.getQuerySelectorText(e);
|
1738
|
+
} catch (f) {
|
1739
|
+
b += " tagName:" + e.tagName, b += " id:" + e.id;
|
1740
|
+
}
|
1741
|
+
}
|
1742
|
+
"" != a.rule.url && (b += "\nSee " + a.rule.url + " for more information.");
|
1743
|
+
return b;
|
1744
|
+
};
|
1745
|
+
goog.exportSymbol("axs.Audit.accessibilityErrorMessage", axs.Audit.accessibilityErrorMessage);
|
1746
|
+
axs.AuditRules.addRule({name:"ariaOnReservedElement", heading:"This element does not support ARIA roles, states and properties", url:"https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules#-ax_aria_12--this-element-does-not-support-aria-roles-states-and-properties", severity:axs.constants.Severity.WARNING, relevantElementMatcher:function(a) {
|
1747
|
+
return !axs.properties.canTakeAriaAttributes(a);
|
1748
|
+
}, test:function(a) {
|
1749
|
+
return null !== axs.properties.getAriaProperties(a);
|
1750
|
+
}, code:"AX_ARIA_12"});
|
1751
|
+
axs.AuditRules.addRule({name:"ariaOwnsDescendant", heading:"aria-owns should not be used if ownership is implicit in the DOM", url:"https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules#-ax_aria_06--aria-owns-should-not-be-used-if-ownership-is-implicit-in-the-dom", severity:axs.constants.Severity.WARNING, relevantElementMatcher:function(a) {
|
1752
|
+
return axs.browserUtils.matchSelector(a, "[aria-owns]");
|
1753
|
+
}, test:function(a) {
|
1754
|
+
return axs.utils.getIdReferents("aria-owns", a).some(function(b) {
|
1755
|
+
return a.compareDocumentPosition(b) & Node.DOCUMENT_POSITION_CONTAINED_BY;
|
1756
|
+
});
|
1757
|
+
}, code:"AX_ARIA_06"});
|
1758
|
+
axs.AuditRules.addRule({name:"ariaRoleNotScoped", heading:"Elements with ARIA roles must be in the correct scope", url:"https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules#-ax_aria_09--elements-with-aria-roles-must-be-in-the-correct-scope", severity:axs.constants.Severity.SEVERE, relevantElementMatcher:function(a) {
|
1759
|
+
return axs.browserUtils.matchSelector(a, "[role]");
|
1760
|
+
}, test:function(a) {
|
1761
|
+
var b = axs.utils.getRoles(a);
|
1762
|
+
if (!b || !b.roles.length) {
|
1763
|
+
return !1;
|
1764
|
+
}
|
1765
|
+
b = b.roles[0];
|
1766
|
+
if (!b || !b.valid) {
|
1767
|
+
return !1;
|
1768
|
+
}
|
1769
|
+
b = b.details.scope;
|
1770
|
+
if (!b || 0 === b.length) {
|
1771
|
+
return !1;
|
1772
|
+
}
|
1773
|
+
for (var c = a;c = c.parentNode;) {
|
1774
|
+
var d = axs.utils.getRoles(c, !0);
|
1775
|
+
if (d && d.roles.length && (d = d.roles[0], 0 <= b.indexOf(d.name))) {
|
1776
|
+
return !1;
|
1777
|
+
}
|
1778
|
+
}
|
1779
|
+
if (a = axs.utils.getIdReferrers("aria-owns", a)) {
|
1780
|
+
for (c = 0;c < a.length;c++) {
|
1781
|
+
if ((d = axs.utils.getRoles(a[c], !0)) && d.roles.length && (d = d.roles[0]), d && 0 <= b.indexOf(d.name)) {
|
1782
|
+
return !1;
|
1783
|
+
}
|
1784
|
+
}
|
1785
|
+
}
|
1786
|
+
return !0;
|
1787
|
+
}, code:"AX_ARIA_09"});
|
1788
|
+
axs.AuditRules.addRule({name:"audioWithoutControls", heading:"Audio elements should have controls", url:"https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules#-ax_audio_01--audio-elements-should-have-controls", severity:axs.constants.Severity.WARNING, relevantElementMatcher:function(a) {
|
1789
|
+
return axs.browserUtils.matchSelector(a, "audio[autoplay]");
|
1790
|
+
}, test:function(a) {
|
1791
|
+
return !a.querySelectorAll("[controls]").length && 3 < a.duration;
|
1792
|
+
}, code:"AX_AUDIO_01"});
|
1793
|
+
(function() {
|
1794
|
+
var a = /^aria\-/;
|
1795
|
+
axs.AuditRules.addRule({name:"badAriaAttribute", heading:"This element has an invalid ARIA attribute", url:"https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules#-ax_aria_11--this-element-has-an-invalid-aria-attribute", severity:axs.constants.Severity.WARNING, relevantElementMatcher:function(b) {
|
1796
|
+
b = b.attributes;
|
1797
|
+
for (var c = 0, d = b.length;c < d;c++) {
|
1798
|
+
if (a.test(b[c].name)) {
|
1799
|
+
return !0;
|
1800
|
+
}
|
1801
|
+
}
|
1802
|
+
return !1;
|
1803
|
+
}, test:function(b) {
|
1804
|
+
b = b.attributes;
|
1805
|
+
for (var c = 0, d = b.length;c < d;c++) {
|
1806
|
+
var e = b[c].name;
|
1807
|
+
if (a.test(e) && (e = e.replace(a, ""), !axs.constants.ARIA_PROPERTIES.hasOwnProperty(e))) {
|
1808
|
+
return !0;
|
1809
|
+
}
|
1810
|
+
}
|
1811
|
+
return !1;
|
1812
|
+
}, code:"AX_ARIA_11"});
|
1813
|
+
})();
|
1814
|
+
axs.AuditRules.addRule({name:"badAriaAttributeValue", heading:"ARIA state and property values must be valid", url:"https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules#-ax_aria_04--aria-state-and-property-values-must-be-valid", severity:axs.constants.Severity.SEVERE, relevantElementMatcher:function(a) {
|
1815
|
+
var b = axs.utils.getSelectorForAriaProperties(axs.constants.ARIA_PROPERTIES);
|
1816
|
+
return axs.browserUtils.matchSelector(a, b);
|
1817
|
+
}, test:function(a) {
|
1818
|
+
for (var b in axs.constants.ARIA_PROPERTIES) {
|
1819
|
+
var c = "aria-" + b;
|
1820
|
+
if (a.hasAttribute(c)) {
|
1821
|
+
var d = a.getAttribute(c);
|
1822
|
+
if (!axs.utils.getAriaPropertyValue(c, d, a).valid) {
|
1823
|
+
return !0;
|
1824
|
+
}
|
1825
|
+
}
|
1826
|
+
}
|
1827
|
+
return !1;
|
1828
|
+
}, code:"AX_ARIA_04"});
|
1829
|
+
axs.AuditRules.addRule({name:"badAriaRole", heading:"Elements with ARIA roles must use a valid, non-abstract ARIA role", url:"https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules#-ax_aria_01--elements-with-aria-roles-must-use-a-valid-non-abstract-aria-role", severity:axs.constants.Severity.SEVERE, relevantElementMatcher:function(a) {
|
1830
|
+
return axs.browserUtils.matchSelector(a, "[role]");
|
1831
|
+
}, test:function(a) {
|
1832
|
+
return !axs.utils.getRoles(a).valid;
|
1833
|
+
}, code:"AX_ARIA_01"});
|
1834
|
+
axs.AuditRules.addRule({name:"controlsWithoutLabel", heading:"Controls and media elements should have labels", url:"https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules#-ax_text_01--controls-and-media-elements-should-have-labels", severity:axs.constants.Severity.SEVERE, relevantElementMatcher:function(a) {
|
1835
|
+
if (!axs.browserUtils.matchSelector(a, 'input:not([type="hidden"]):not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), video:not([disabled])') || "presentation" == a.getAttribute("role")) {
|
1836
|
+
return !1;
|
1837
|
+
}
|
1838
|
+
if (0 <= a.tabIndex) {
|
1839
|
+
return !0;
|
1840
|
+
}
|
1841
|
+
for (a = axs.utils.parentElement(a);null != a;a = axs.utils.parentElement(a)) {
|
1842
|
+
if (axs.utils.elementIsAriaWidget(a)) {
|
1843
|
+
return !1;
|
1844
|
+
}
|
1845
|
+
}
|
1846
|
+
return !0;
|
1847
|
+
}, test:function(a) {
|
1848
|
+
return axs.utils.isElementOrAncestorHidden(a) || "input" == a.tagName.toLowerCase() && "button" == a.type && a.value.length || "button" == a.tagName.toLowerCase() && a.textContent.replace(/^\s+|\s+$/g, "").length ? !1 : axs.utils.hasLabel(a) ? !1 : !0;
|
1849
|
+
}, code:"AX_TEXT_01", ruleName:"Controls and media elements should have labels"});
|
1850
|
+
axs.AuditRules.addRule({name:"duplicateId", heading:"An element's ID must be unique in the DOM", url:"https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules#-ax_html_02--an-elements-id-must-be-unique-in-the-dom", severity:axs.constants.Severity.SEVERE, relevantElementMatcher:function(a) {
|
1851
|
+
return axs.browserUtils.matchSelector(a, "[id]");
|
1852
|
+
}, test:function(a) {
|
1853
|
+
var b = a.id;
|
1854
|
+
if (!b) {
|
1855
|
+
return !1;
|
1856
|
+
}
|
1857
|
+
b = "[id='" + b.replace(/'/g, "\\'") + "']";
|
1858
|
+
return 1 < a.ownerDocument.querySelectorAll(b).length;
|
1859
|
+
}, code:"AX_HTML_02"});
|
1860
|
+
axs.AuditRules.addRule({name:"focusableElementNotVisibleAndNotAriaHidden", heading:"These elements are focusable but either invisible or obscured by another element", url:"https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules#-ax_focus_01--these-elements-are-focusable-but-either-invisible-or-obscured-by-another-element", severity:axs.constants.Severity.WARNING, relevantElementMatcher:function(a) {
|
1861
|
+
if (!axs.browserUtils.matchSelector(a, axs.utils.FOCUSABLE_ELEMENTS_SELECTOR)) {
|
1862
|
+
return !1;
|
1863
|
+
}
|
1864
|
+
if (0 <= a.tabIndex) {
|
1865
|
+
return !0;
|
1866
|
+
}
|
1867
|
+
for (var b = axs.utils.parentElement(a);null != b;b = axs.utils.parentElement(b)) {
|
1868
|
+
if (axs.utils.elementIsAriaWidget(b)) {
|
1869
|
+
return !1;
|
1870
|
+
}
|
1871
|
+
}
|
1872
|
+
return "" === axs.properties.findTextAlternatives(a, {}).trim() ? !1 : !0;
|
1873
|
+
}, test:function(a) {
|
1874
|
+
if (axs.utils.isElementOrAncestorHidden(a)) {
|
1875
|
+
return !1;
|
1876
|
+
}
|
1877
|
+
a.focus();
|
1878
|
+
return !axs.utils.elementIsVisible(a);
|
1879
|
+
}, code:"AX_FOCUS_01"});
|
1880
|
+
axs.AuditRules.addRule({name:"humanLangMissing", heading:"The web page should have the content's human language indicated in the markup", url:"https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules#-ax_html_01--the-web-page-should-have-the-contents-human-language-indicated-in-the-markup", severity:axs.constants.Severity.WARNING, relevantElementMatcher:function(a) {
|
1881
|
+
return a instanceof a.ownerDocument.defaultView.HTMLHtmlElement;
|
1882
|
+
}, test:function(a) {
|
1883
|
+
return a.lang ? !1 : !0;
|
1884
|
+
}, code:"AX_HTML_01"});
|
1885
|
+
axs.AuditRules.addRule({name:"imagesWithoutAltText", heading:"Images should have an alt attribute", url:"https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules#-ax_text_02--images-should-have-an-alt-attribute-unless-they-have-an-aria-role-of-presentation", severity:axs.constants.Severity.WARNING, relevantElementMatcher:function(a) {
|
1886
|
+
return axs.browserUtils.matchSelector(a, "img") && !axs.utils.isElementOrAncestorHidden(a);
|
1887
|
+
}, test:function(a) {
|
1888
|
+
return !a.hasAttribute("alt") && "presentation" != a.getAttribute("role");
|
1889
|
+
}, code:"AX_TEXT_02"});
|
1890
|
+
axs.AuditRules.addRule({name:"linkWithUnclearPurpose", heading:"The purpose of each link should be clear from the link text", url:"https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules#-ax_text_04--the-purpose-of-each-link-should-be-clear-from-the-link-text", severity:axs.constants.Severity.WARNING, relevantElementMatcher:function(a) {
|
1891
|
+
return axs.browserUtils.matchSelector(a, "a");
|
1892
|
+
}, test:function(a, b) {
|
1893
|
+
for (var c = b || {}, d = c.blacklistPhrases || [], e = /\s+/, f = 0;f < d.length;f++) {
|
1894
|
+
var g = "^\\s*" + d[f].trim().replace(e, "\\s*") + "s*[^a-z]$";
|
1895
|
+
if ((new RegExp(g, "i")).test(a.textContent)) {
|
1896
|
+
return !0;
|
1897
|
+
}
|
1898
|
+
}
|
1899
|
+
c = c.stopwords || "click tap go here learn more this page link about".split(" ");
|
1900
|
+
d = a.textContent;
|
1901
|
+
d = d.replace(/[^a-zA-Z ]/g, "");
|
1902
|
+
for (f = 0;f < c.length;f++) {
|
1903
|
+
if (d = d.replace(new RegExp("\\b" + c[f] + "\\b", "ig"), ""), "" == d.trim()) {
|
1904
|
+
return !0;
|
1905
|
+
}
|
1906
|
+
}
|
1907
|
+
return !1;
|
1908
|
+
}, code:"AX_TEXT_04"});
|
1909
|
+
axs.AuditRules.addRule({name:"lowContrastElements", heading:"Text elements should have a reasonable contrast ratio", url:"https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules#-ax_color_01--text-elements-should-have-a-reasonable-contrast-ratio", severity:axs.constants.Severity.WARNING, relevantElementMatcher:function(a) {
|
1910
|
+
return axs.properties.hasDirectTextDescendant(a);
|
1911
|
+
}, test:function(a) {
|
1912
|
+
var b = window.getComputedStyle(a, null);
|
1913
|
+
return (a = axs.utils.getContrastRatioForElementWithComputedStyle(b, a)) && axs.utils.isLowContrast(a, b);
|
1914
|
+
}, code:"AX_COLOR_01"});
|
1915
|
+
axs.AuditRules.addRule({name:"mainRoleOnInappropriateElement", heading:"role=main should only appear on significant elements", url:"https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules#-ax_aria_05--rolemain-should-only-appear-on-significant-elements", severity:axs.constants.Severity.WARNING, relevantElementMatcher:function(a) {
|
1916
|
+
return axs.browserUtils.matchSelector(a, "[role~=main]");
|
1917
|
+
}, test:function(a) {
|
1918
|
+
if (axs.utils.isInlineElement(a)) {
|
1919
|
+
return !0;
|
1920
|
+
}
|
1921
|
+
a = axs.properties.getTextFromDescendantContent(a);
|
1922
|
+
return !a || 50 > a.length ? !0 : !1;
|
1923
|
+
}, code:"AX_ARIA_05"});
|
1924
|
+
axs.AuditRules.addRule({name:"elementsWithMeaningfulBackgroundImage", severity:axs.constants.Severity.WARNING, relevantElementMatcher:function(a) {
|
1925
|
+
return !axs.utils.isElementOrAncestorHidden(a);
|
1926
|
+
}, heading:"Meaningful images should not be used in element backgrounds", url:"https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules#-ax_image_01--meaningful-images-should-not-be-used-in-element-backgrounds", test:function(a) {
|
1927
|
+
if (a.textContent && 0 < a.textContent.length) {
|
1928
|
+
return !1;
|
1929
|
+
}
|
1930
|
+
a = window.getComputedStyle(a, null);
|
1931
|
+
var b = a.backgroundImage;
|
1932
|
+
if (!b || "undefined" === b || "none" === b || 0 != b.indexOf("url")) {
|
1933
|
+
return !1;
|
1934
|
+
}
|
1935
|
+
b = parseInt(a.width, 10);
|
1936
|
+
a = parseInt(a.height, 10);
|
1937
|
+
return 150 > b && 150 > a;
|
1938
|
+
}, code:"AX_IMAGE_01"});
|
1939
|
+
axs.AuditRules.addRule({name:"multipleAriaOwners", heading:"An element's ID must not be present in more that one aria-owns attribute at any time", url:"https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules#-ax_aria_07--an-element-can-have-only-one-explicit-aria-owner", severity:axs.constants.Severity.WARNING, relevantElementMatcher:function(a) {
|
1940
|
+
return axs.browserUtils.matchSelector(a, "[aria-owns]");
|
1941
|
+
}, test:function(a) {
|
1942
|
+
return axs.utils.getIdReferents("aria-owns", a).some(function(a) {
|
1943
|
+
return 1 < axs.utils.getIdReferrers("aria-owns", a).length;
|
1944
|
+
});
|
1945
|
+
}, code:"AX_ARIA_07"});
|
1946
|
+
axs.AuditRules.addRule({name:"nonExistentAriaRelatedElement", heading:"ARIA attributes which refer to other elements by ID should refer to elements which exist in the DOM", url:"https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules#-ax_aria_02--aria-labelledby-attributes-should-refer-to-an-element-which-exists-in-the-dom", severity:axs.constants.Severity.SEVERE, relevantElementMatcher:function(a) {
|
1947
|
+
var b = axs.utils.getAriaPropertiesByValueType(["idref", "idref_list"]), b = axs.utils.getSelectorForAriaProperties(b);
|
1948
|
+
return axs.browserUtils.matchSelector(a, b);
|
1949
|
+
}, test:function(a) {
|
1950
|
+
for (var b = axs.utils.getAriaPropertiesByValueType(["idref", "idref_list"]), b = axs.utils.getSelectorForAriaProperties(b).split(","), c = 0, d = b.length;c < d;c++) {
|
1951
|
+
var e = b[c];
|
1952
|
+
if (axs.browserUtils.matchSelector(a, e)) {
|
1953
|
+
var e = e.match(/aria-[^\]]+/)[0], f = a.getAttribute(e);
|
1954
|
+
if (!axs.utils.getAriaPropertyValue(e, f, a).valid) {
|
1955
|
+
return !0;
|
1956
|
+
}
|
1957
|
+
}
|
1958
|
+
}
|
1959
|
+
return !1;
|
1960
|
+
}, code:"AX_ARIA_02"});
|
1961
|
+
axs.AuditRules.addRule({name:"pageWithoutTitle", heading:"The web page should have a title that describes topic or purpose", url:"https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules#-ax_title_01--the-web-page-should-have-a-title-that-describes-topic-or-purpose", severity:axs.constants.Severity.WARNING, relevantElementMatcher:function(a) {
|
1962
|
+
return "html" == a.tagName.toLowerCase();
|
1963
|
+
}, test:function(a) {
|
1964
|
+
a = a.querySelector("head");
|
1965
|
+
return a ? (a = a.querySelector("title")) ? !a.textContent : !0 : !0;
|
1966
|
+
}, code:"AX_TITLE_01"});
|
1967
|
+
axs.AuditRules.addRule({name:"requiredAriaAttributeMissing", heading:"Elements with ARIA roles must have all required attributes for that role", url:"https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules#-ax_aria_03--elements-with-aria-roles-must-have-all-required-attributes-for-that-role", severity:axs.constants.Severity.SEVERE, relevantElementMatcher:function(a) {
|
1968
|
+
return axs.browserUtils.matchSelector(a, "[role]");
|
1969
|
+
}, test:function(a) {
|
1970
|
+
var b = axs.utils.getRoles(a);
|
1971
|
+
if (!b.valid) {
|
1972
|
+
return !1;
|
1973
|
+
}
|
1974
|
+
for (var c = 0;c < b.roles.length;c++) {
|
1975
|
+
var d = b.roles[c].details.requiredPropertiesSet, e;
|
1976
|
+
for (e in d) {
|
1977
|
+
if (d = e.replace(/^aria-/, ""), !("defaultValue" in axs.constants.ARIA_PROPERTIES[d] || a.hasAttribute(e)) && 0 > axs.properties.getNativelySupportedAttributes(a).indexOf(e)) {
|
1978
|
+
return !0;
|
1979
|
+
}
|
1980
|
+
}
|
1981
|
+
}
|
1982
|
+
}, code:"AX_ARIA_03"});
|
1983
|
+
(function() {
|
1984
|
+
function a(a) {
|
1985
|
+
a = axs.utils.getRoles(a);
|
1986
|
+
if (!a || !a.roles.length) {
|
1987
|
+
return [];
|
1988
|
+
}
|
1989
|
+
a = a.roles[0];
|
1990
|
+
return a.valid ? a.details.mustcontain || [] : [];
|
1991
|
+
}
|
1992
|
+
axs.AuditRules.addRule({name:"requiredOwnedAriaRoleMissing", heading:"Elements with ARIA roles must ensure required owned elements are present", url:"https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules#-ax_aria_08--elements-with-aria-roles-must-ensure-required-owned-elements-are-present", severity:axs.constants.Severity.SEVERE, relevantElementMatcher:function(b) {
|
1993
|
+
return axs.browserUtils.matchSelector(b, "[role]") ? 0 < a(b).length : !1;
|
1994
|
+
}, test:function(b) {
|
1995
|
+
if ("true" === b.getAttribute("aria-busy")) {
|
1996
|
+
return !1;
|
1997
|
+
}
|
1998
|
+
for (var c = a(b), d = c.length - 1;0 <= d;d--) {
|
1999
|
+
var e = axs.utils.findDescendantsWithRole(b, c[d]);
|
2000
|
+
if (e && e.length) {
|
2001
|
+
return !1;
|
2002
|
+
}
|
2003
|
+
}
|
2004
|
+
b = axs.utils.getIdReferents("aria-owns", b);
|
2005
|
+
for (d = b.length - 1;0 <= d;d--) {
|
2006
|
+
if ((e = axs.utils.getRoles(b[d], !0)) && e.roles.length) {
|
2007
|
+
for (var e = e.roles[0], f = c.length - 1;0 <= f;f--) {
|
2008
|
+
if (e.name === c[f]) {
|
2009
|
+
return !1;
|
2010
|
+
}
|
2011
|
+
}
|
2012
|
+
}
|
2013
|
+
}
|
2014
|
+
return !0;
|
2015
|
+
}, code:"AX_ARIA_08"});
|
2016
|
+
})();
|
2017
|
+
axs.AuditRules.addRule({name:"tabIndexGreaterThanZero", heading:"Avoid positive integer values for tabIndex", url:"https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules#-ax_focus_03--avoid-positive-integer-values-for-tabindex", severity:axs.constants.Severity.WARNING, relevantElementMatcher:function(a) {
|
2018
|
+
return axs.browserUtils.matchSelector(a, "[tabindex]");
|
2019
|
+
}, test:function(a) {
|
2020
|
+
if (0 < a.tabIndex) {
|
2021
|
+
return !0;
|
2022
|
+
}
|
2023
|
+
}, code:"AX_FOCUS_03"});
|
2024
|
+
axs.AuditRules.addRule({name:"unfocusableElementsWithOnClick", heading:"Elements with onclick handlers must be focusable", url:"https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules#-ax_focus_02--elements-with-onclick-handlers-must-be-focusable", severity:axs.constants.Severity.WARNING, opt_requiresConsoleAPI:!0, relevantElementMatcher:function(a) {
|
2025
|
+
return a instanceof a.ownerDocument.defaultView.HTMLBodyElement || axs.utils.isElementOrAncestorHidden(a) ? !1 : "click" in getEventListeners(a) ? !0 : !1;
|
2026
|
+
}, test:function(a) {
|
2027
|
+
return !a.hasAttribute("tabindex") && !axs.utils.isElementImplicitlyFocusable(a) && !a.disabled;
|
2028
|
+
}, code:"AX_FOCUS_02"});
|
2029
|
+
(function() {
|
2030
|
+
var a = /^aria\-/, b = axs.utils.getSelectorForAriaProperties(axs.constants.ARIA_PROPERTIES);
|
2031
|
+
axs.AuditRules.addRule({name:"unsupportedAriaAttribute", heading:"This element has an unsupported ARIA attribute", url:"https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules#-ax_aria_10--this-element-has-an-unsupported-aria-attribute", severity:axs.constants.Severity.SEVERE, relevantElementMatcher:function(a) {
|
2032
|
+
return axs.browserUtils.matchSelector(a, b);
|
2033
|
+
}, test:function(b) {
|
2034
|
+
var d = axs.utils.getRoles(b, !0), d = d && d.roles.length ? d.roles[0].details.propertiesSet : axs.constants.GLOBAL_PROPERTIES;
|
2035
|
+
b = b.attributes;
|
2036
|
+
for (var e = 0, f = b.length;e < f;e++) {
|
2037
|
+
var g = b[e].name;
|
2038
|
+
if (a.test(g)) {
|
2039
|
+
var h = g.replace(a, "");
|
2040
|
+
if (axs.constants.ARIA_PROPERTIES.hasOwnProperty(h) && !(g in d)) {
|
2041
|
+
return !0;
|
2042
|
+
}
|
2043
|
+
}
|
2044
|
+
}
|
2045
|
+
return !1;
|
2046
|
+
}, code:"AX_ARIA_10"});
|
2047
|
+
})();
|
2048
|
+
axs.AuditRules.addRule({name:"videoWithoutCaptions", heading:"Video elements should use <track> elements to provide captions", url:"https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules#-ax_video_01--video-elements-should-use-track-elements-to-provide-captions", severity:axs.constants.Severity.WARNING, relevantElementMatcher:function(a) {
|
2049
|
+
return axs.browserUtils.matchSelector(a, "video");
|
2050
|
+
}, test:function(a) {
|
2051
|
+
return !a.querySelectorAll("track[kind=captions]").length;
|
2052
|
+
}, code:"AX_VIDEO_01"});
|