OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2014 Google Inc. |
3 * | 3 * |
4 * Licensed under the Apache License, Version 2.0 (the "License"); | 4 * Licensed under the Apache License, Version 2.0 (the "License"); |
5 * you may not use this file except in compliance with 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 | 6 * You may obtain a copy of the License at |
7 * | 7 * |
8 * http://www.apache.org/licenses/LICENSE-2.0 | 8 * http://www.apache.org/licenses/LICENSE-2.0 |
9 * | 9 * |
10 * Unless required by applicable law or agreed to in writing, software | 10 * Unless required by applicable law or agreed to in writing, software |
11 * distributed under the License is distributed on an "AS IS" BASIS, | 11 * distributed under the License is distributed on an "AS IS" BASIS, |
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
13 * See the License for the specific language governing permissions and | 13 * See the License for the specific language governing permissions and |
14 * limitations under the License. | 14 * limitations under the License. |
15 * | 15 * |
16 * Generated from http://github.com/GoogleChrome/accessibility-developer-tools/t
ree/404ede0f2186682fbbef624141e76ec2b601317d | 16 * Generated from http://github.com/GoogleChrome/accessibility-developer-tools/t
ree/3d4893b4ecd0eb8f4765e04479213d04b240f3e0 |
17 * | 17 * |
18 * See project README for build steps. | 18 * See project README for build steps. |
19 */ | 19 */ |
20 | 20 |
21 // AUTO-GENERATED CONTENT BELOW: DO NOT EDIT! See above for details. | 21 // AUTO-GENERATED CONTENT BELOW: DO NOT EDIT! See above for details. |
22 | 22 |
23 var fn = (function() { | 23 var COMPILED = !0, goog = goog || {}; |
24 var COMPILED = !0, goog = goog || {}; | |
25 goog.global = this; | 24 goog.global = this; |
26 goog.isDef = function(a) { | 25 goog.isDef = function(a) { |
27 return void 0 !== a; | 26 return void 0 !== a; |
28 }; | 27 }; |
29 goog.exportPath_ = function(a, b, c) { | 28 goog.exportPath_ = function(a, b, c) { |
30 a = a.split("."); | 29 a = a.split("."); |
31 c = c || goog.global; | 30 c = c || goog.global; |
32 a[0] in c || !c.execScript || c.execScript("var " + a[0]); | 31 a[0] in c || !c.execScript || c.execScript("var " + a[0]); |
33 for (var d;a.length && (d = a.shift());) { | 32 for (var d;a.length && (d = a.shift());) { |
34 !a.length && goog.isDef(b) ? c[d] = b : c = c[d] ? c[d] : c[d] = {}; | 33 !a.length && goog.isDef(b) ? c[d] = b : c = c[d] ? c[d] : c[d] = {}; |
(...skipping 21 matching lines...) Expand all Loading... |
56 goog.exportPath_(a); | 55 goog.exportPath_(a); |
57 }; | 56 }; |
58 goog.setTestOnly = function(a) { | 57 goog.setTestOnly = function(a) { |
59 if (COMPILED && !goog.DEBUG) { | 58 if (COMPILED && !goog.DEBUG) { |
60 throw a = a || "", Error("Importing test-only code into non-debug environmen
t" + a ? ": " + a : "."); | 59 throw a = a || "", Error("Importing test-only code into non-debug environmen
t" + a ? ": " + a : "."); |
61 } | 60 } |
62 }; | 61 }; |
63 goog.forwardDeclare = function(a) { | 62 goog.forwardDeclare = function(a) { |
64 }; | 63 }; |
65 COMPILED || (goog.isProvided_ = function(a) { | 64 COMPILED || (goog.isProvided_ = function(a) { |
66 return !goog.implicitNamespaces_[a] && goog.isDefAndNotNull(goog.getObjectByNa
me(a)); | 65 return!goog.implicitNamespaces_[a] && goog.isDefAndNotNull(goog.getObjectByNam
e(a)); |
67 }, goog.implicitNamespaces_ = {}); | 66 }, goog.implicitNamespaces_ = {}); |
68 goog.getObjectByName = function(a, b) { | 67 goog.getObjectByName = function(a, b) { |
69 for (var c = a.split("."), d = b || goog.global, e;e = c.shift();) { | 68 for (var c = a.split("."), d = b || goog.global, e;e = c.shift();) { |
70 if (goog.isDefAndNotNull(d[e])) { | 69 if (goog.isDefAndNotNull(d[e])) { |
71 d = d[e]; | 70 d = d[e]; |
72 } else { | 71 } else { |
73 return null; | 72 return null; |
74 } | 73 } |
75 } | 74 } |
76 return d; | 75 return d; |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 } | 146 } |
148 } | 147 } |
149 }, goog.importScript_ = function(a) { | 148 }, goog.importScript_ = function(a) { |
150 var b = goog.global.CLOSURE_IMPORT_SCRIPT || goog.writeScriptTag_; | 149 var b = goog.global.CLOSURE_IMPORT_SCRIPT || goog.writeScriptTag_; |
151 !goog.dependencies_.written[a] && b(a) && (goog.dependencies_.written[a] = !0)
; | 150 !goog.dependencies_.written[a] && b(a) && (goog.dependencies_.written[a] = !0)
; |
152 }, goog.writeScriptTag_ = function(a) { | 151 }, goog.writeScriptTag_ = function(a) { |
153 if (goog.inHtmlDocument_()) { | 152 if (goog.inHtmlDocument_()) { |
154 var b = goog.global.document; | 153 var b = goog.global.document; |
155 if ("complete" == b.readyState) { | 154 if ("complete" == b.readyState) { |
156 if (/\bdeps.js$/.test(a)) { | 155 if (/\bdeps.js$/.test(a)) { |
157 return !1; | 156 return!1; |
158 } | 157 } |
159 throw Error('Cannot write "' + a + '" after document load'); | 158 throw Error('Cannot write "' + a + '" after document load'); |
160 } | 159 } |
161 b.write('<script type="text/javascript" src="' + a + '">\x3c/script>'); | 160 b.write('<script type="text/javascript" src="' + a + '">\x3c/script>'); |
162 return !0; | 161 return!0; |
163 } | 162 } |
164 return !1; | 163 return!1; |
165 }, goog.writeScripts_ = function() { | 164 }, goog.writeScripts_ = function() { |
166 function a(e) { | 165 function a(e) { |
167 if (!(e in d.written)) { | 166 if (!(e in d.written)) { |
168 if (!(e in d.visited) && (d.visited[e] = !0, e in d.requires)) { | 167 if (!(e in d.visited) && (d.visited[e] = !0, e in d.requires)) { |
169 for (var g in d.requires[e]) { | 168 for (var g in d.requires[e]) { |
170 if (!goog.isProvided_(g)) { | 169 if (!goog.isProvided_(g)) { |
171 if (g in d.nameToPath) { | 170 if (g in d.nameToPath) { |
172 a(d.nameToPath[g]); | 171 a(d.nameToPath[g]); |
173 } else { | 172 } else { |
174 throw Error("Undefined nameToPath for " + g); | 173 throw Error("Undefined nameToPath for " + g); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 return "function" == goog.typeOf(a); | 251 return "function" == goog.typeOf(a); |
253 }; | 252 }; |
254 goog.isObject = function(a) { | 253 goog.isObject = function(a) { |
255 var b = typeof a; | 254 var b = typeof a; |
256 return "object" == b && null != a || "function" == b; | 255 return "object" == b && null != a || "function" == b; |
257 }; | 256 }; |
258 goog.getUid = function(a) { | 257 goog.getUid = function(a) { |
259 return a[goog.UID_PROPERTY_] || (a[goog.UID_PROPERTY_] = ++goog.uidCounter_); | 258 return a[goog.UID_PROPERTY_] || (a[goog.UID_PROPERTY_] = ++goog.uidCounter_); |
260 }; | 259 }; |
261 goog.hasUid = function(a) { | 260 goog.hasUid = function(a) { |
262 return !!a[goog.UID_PROPERTY_]; | 261 return!!a[goog.UID_PROPERTY_]; |
263 }; | 262 }; |
264 goog.removeUid = function(a) { | 263 goog.removeUid = function(a) { |
265 "removeAttribute" in a && a.removeAttribute(goog.UID_PROPERTY_); | 264 "removeAttribute" in a && a.removeAttribute(goog.UID_PROPERTY_); |
266 try { | 265 try { |
267 delete a[goog.UID_PROPERTY_]; | 266 delete a[goog.UID_PROPERTY_]; |
268 } catch (b) { | 267 } catch (b) { |
269 } | 268 } |
270 }; | 269 }; |
271 goog.UID_PROPERTY_ = "closure_uid_" + (1E9 * Math.random() >>> 0); | 270 goog.UID_PROPERTY_ = "closure_uid_" + (1E9 * Math.random() >>> 0); |
272 goog.uidCounter_ = 0; | 271 goog.uidCounter_ = 0; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 b.push.apply(b, arguments); | 315 b.push.apply(b, arguments); |
317 return a.apply(this, b); | 316 return a.apply(this, b); |
318 }; | 317 }; |
319 }; | 318 }; |
320 goog.mixin = function(a, b) { | 319 goog.mixin = function(a, b) { |
321 for (var c in b) { | 320 for (var c in b) { |
322 a[c] = b[c]; | 321 a[c] = b[c]; |
323 } | 322 } |
324 }; | 323 }; |
325 goog.now = goog.TRUSTED_SITE && Date.now || function() { | 324 goog.now = goog.TRUSTED_SITE && Date.now || function() { |
326 return +new Date; | 325 return+new Date; |
327 }; | 326 }; |
328 goog.globalEval = function(a) { | 327 goog.globalEval = function(a) { |
329 if (goog.global.execScript) { | 328 if (goog.global.execScript) { |
330 goog.global.execScript(a, "JavaScript"); | 329 goog.global.execScript(a, "JavaScript"); |
331 } else { | 330 } else { |
332 if (goog.global.eval) { | 331 if (goog.global.eval) { |
333 if (null == goog.evalWorksForGlobals_ && (goog.global.eval("var _et_ = 1;"
), "undefined" != typeof goog.global._et_ ? (delete goog.global._et_, goog.evalW
orksForGlobals_ = !0) : goog.evalWorksForGlobals_ = !1), goog.evalWorksForGlobal
s_) { | 332 if (null == goog.evalWorksForGlobals_ && (goog.global.eval("var _et_ = 1;"
), "undefined" != typeof goog.global._et_ ? (delete goog.global._et_, goog.evalW
orksForGlobals_ = !0) : goog.evalWorksForGlobals_ = !1), goog.evalWorksForGlobal
s_) { |
334 goog.global.eval(a); | 333 goog.global.eval(a); |
335 } else { | 334 } else { |
336 var b = goog.global.document, c = b.createElement("script"); | 335 var b = goog.global.document, c = b.createElement("script"); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 return a.constructor.prototype[b].apply(a, e); | 414 return a.constructor.prototype[b].apply(a, e); |
416 } | 415 } |
417 throw Error("goog.base called from a method of one name to a method of a diffe
rent name"); | 416 throw Error("goog.base called from a method of one name to a method of a diffe
rent name"); |
418 }; | 417 }; |
419 goog.scope = function(a) { | 418 goog.scope = function(a) { |
420 a.call(goog.global); | 419 a.call(goog.global); |
421 }; | 420 }; |
422 var axs = {}; | 421 var axs = {}; |
423 axs.browserUtils = {}; | 422 axs.browserUtils = {}; |
424 axs.browserUtils.matchSelector = function(a, b) { | 423 axs.browserUtils.matchSelector = function(a, b) { |
425 return a.matches ? a.matches(b) : a.webkitMatchesSelector ? a.webkitMatchesSel
ector(b) : a.mozMatchesSelector ? a.mozMatchesSelector(b) : a.msMatchesSelector
? a.msMatchesSelector(b) : !1; | 424 return a.webkitMatchesSelector ? a.webkitMatchesSelector(b) : a.mozMatchesSele
ctor ? a.mozMatchesSelector(b) : !1; |
426 }; | 425 }; |
427 axs.constants = {}; | 426 axs.constants = {}; |
428 axs.constants.ARIA_ROLES = {alert:{namefrom:["author"], parent:["region"]}, aler
tdialog:{namefrom:["author"], namerequired:!0, parent:["alert", "dialog"]}, appl
ication:{namefrom:["author"], namerequired:!0, parent:["landmark"]}, article:{na
mefrom:["author"], parent:["document", "region"]}, banner:{namefrom:["author"],
parent:["landmark"]}, button:{childpresentational:!0, namefrom:["contents", "aut
hor"], namerequired:!0, parent:["command"], properties:["aria-expanded", "aria-p
ressed"]}, checkbox:{namefrom:["contents", | 427 axs.constants.ARIA_ROLES = {alert:{namefrom:["author"], parent:["region"]}, aler
tdialog:{namefrom:["author"], namerequired:!0, parent:["alert", "dialog"]}, appl
ication:{namefrom:["author"], namerequired:!0, parent:["landmark"]}, article:{na
mefrom:["author"], parent:["document", "region"]}, banner:{namefrom:["author"],
parent:["landmark"]}, button:{childpresentational:!0, namefrom:["contents", "aut
hor"], namerequired:!0, parent:["command"], properties:["aria-expanded", "aria-p
ressed"]}, checkbox:{namefrom:["contents", |
429 "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-expand
ed"], properties:["aria-expanded", "aria-autocomplete", "aria-required"]}, comma
nd:{"abstract":!0, namefrom:["author"], | 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"]}, combobox:{mustcontain:["listbox", "textbox"], namefrom:["author"], nam
erequired:!0, parent:["select"], requiredProperties:["aria-expanded"], propertie
s:["aria-expanded", "aria-autocomplete", "aria-required"]}, command:{"abstract":
!0, namefrom:["author"], |
430 parent:["widget"]}, complementary:{namefrom:["author"], parent:["landmark"]}, co
mposite:{"abstract":!0, childpresentational:!1, namefrom:["author"], parent:["wi
dget"], properties:["aria-activedescendant"]}, contentinfo:{namefrom:["author"],
parent:["landmark"]}, definition:{namefrom:["author"], parent:["section"]}, dia
log:{namefrom:["author"], namerequired:!0, parent:["window"]}, directory:{namefr
om:["contents", "author"], parent:["list"]}, document:{namefrom:[" author"], nam
erequired:!0, parent:["structure"], | 429 parent:["widget"]}, complementary:{namefrom:["author"], parent:["landmark"]}, co
mposite:{"abstract":!0, childpresentational:!1, namefrom:["author"], parent:["wi
dget"], properties:["aria-activedescendant"]}, contentinfo:{namefrom:["author"],
parent:["landmark"]}, definition:{namefrom:["author"], parent:["section"]}, dia
log:{namefrom:["author"], namerequired:!0, parent:["window"]}, directory:{namefr
om:["contents", "author"], parent:["list"]}, document:{namefrom:[" author"], nam
erequired:!0, parent:["structure"], |
431 properties:["aria-expanded"]}, form:{namefrom:["author"], parent:["landmark"]},
grid:{mustcontain:["row", "rowgroup"], namefrom:["author"], namerequired:!0, par
ent:["composite", "region"], properties:["aria-level", "aria-multiselectable", "
aria-readonly"]}, gridcell:{namefrom:["contents", "author"], namerequired:!0, pa
rent:["section", "widget"], properties:["aria-readonly", "aria-required", "aria-
selected"], scope:["row"]}, group:{namefrom:[" author"], parent:["section"], pro
perties:["aria-activedescendant"]}, | 430 properties:["aria-expanded"]}, form:{namefrom:["author"], parent:["landmark"]},
grid:{mustcontain:["row", "rowgroup"], namefrom:["author"], namerequired:!0, par
ent:["composite", "region"], properties:["aria-level", "aria-multiselectable", "
aria-readonly"]}, gridcell:{namefrom:["contents", "author"], namerequired:!0, pa
rent:["section", "widget"], properties:["aria-readonly", "aria-required", "aria-
selected"]}, group:{namefrom:[" author"], parent:["section"], properties:["aria-
activedescendant"]}, |
432 heading:{namerequired:!0, parent:["sectionhead"], properties:["aria-level"]}, im
g:{childpresentational:!0, namefrom:["author"], namerequired:!0, parent:["sectio
n"]}, 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"]}, | 431 heading:{namerequired:!0, parent:["sectionhead"], properties:["aria-level"]}, im
g:{childpresentational:!0, namefrom:["author"], namerequired:!0, parent:["sectio
n"]}, 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"]}, |
433 listbox:{mustcontain:["option"], namefrom:["author"], namerequired:!0, parent:["
list", "select"], properties:["aria-multiselectable", "aria-required"]}, listite
m:{namefrom:["contents", "author"], namerequired:!0, parent:["section"], propert
ies:["aria-level", "aria-posinset", "aria-setsize"], scope:["list"]}, log:{namef
rom:[" author"], namerequired:!0, parent:["region"]}, main:{namefrom:["author"],
parent:["landmark"]}, marquee:{namerequired:!0, parent:["section"]}, math:{chil
dpresentational:!0, namefrom:["author"], | 432 listbox:{mustcontain:["option"], namefrom:["author"], namerequired:!0, parent:["
list", "select"], properties:["aria-multiselectable", "aria-required"]}, listite
m:{namefrom:["contents", "author"], namerequired:!0, parent:["section"], propert
ies:["aria-level", "aria-posinset", "aria-setsize"]}, log:{namefrom:[" author"],
namerequired:!0, parent:["region"]}, main:{namefrom:["author"], parent:["landma
rk"]}, marquee:{namerequired:!0, parent:["section"]}, math:{childpresentational:
!0, namefrom:["author"], |
434 parent:["section"]}, menu:{mustcontain:["group", "menuitemradio", "menuitem", "m
enuitemcheckbox"], namefrom:["author"], namerequired:!0, parent:["list", "select
"]}, menubar:{namefrom:["author"], parent:["menu"]}, menuitem:{namefrom:["conten
ts", "author"], namerequired:!0, parent:["command"], scope:["menu", "menubar"]},
menuitemcheckbox:{namefrom:["contents", "author"], namerequired:!0, parent:["ch
eckbox", "menuitem"], scope:["menu", "menubar"]}, menuitemradio:{namefrom:["cont
ents", "author"], namerequired:!0, | 433 parent:["section"]}, menu:{mustcontain:["group", "menuitemradio", "menuitem", "m
enuitemcheckbox"], namefrom:["author"], namerequired:!0, parent:["list", "select
"]}, menubar:{namefrom:["author"], parent:["menu"]}, menuitem:{namefrom:["conten
ts", "author"], namerequired:!0, parent:["command"]}, menuitemcheckbox:{namefrom
:["contents", "author"], namerequired:!0, parent:["checkbox", "menuitem"]}, menu
itemradio:{namefrom:["contents", "author"], namerequired:!0, parent:["menuitemch
eckbox", "radio"]}, navigation:{namefrom:["author"], |
435 parent:["menuitemcheckbox", "radio"], scope:["menu", "menubar"]}, navigation:{na
mefrom:["author"], parent:["landmark"]}, note:{namefrom:["author"], parent:["sec
tion"]}, option:{namefrom:["contents", "author"], namerequired:!0, parent:["inpu
t"], properties:["aria-checked", "aria-posinset", "aria-selected", "aria-setsize
"]}, presentation:{parent:["structure"]}, progressbar:{childpresentational:!0, n
amefrom:["author"], namerequired:!0, parent:["range"]}, radio:{namefrom:["conten
ts", "author"], namerequired:!0, | 434 parent:["landmark"]}, note:{namefrom:["author"], parent:["section"]}, option:{na
mefrom:["contents", "author"], namerequired:!0, parent:["input"], properties:["a
ria-checked", "aria-posinset", "aria-selected", "aria-setsize"]}, presentation:{
parent:["structure"]}, progressbar:{childpresentational:!0, namefrom:["author"],
namerequired:!0, parent:["range"]}, radio:{namefrom:["contents", "author"], nam
erequired:!0, parent:["checkbox", "option"]}, radiogroup:{mustcontain:["radio"],
namefrom:["author"], |
436 parent:["checkbox", "option"]}, radiogroup:{mustcontain:["radio"], namefrom:["au
thor"], namerequired:!0, parent:["select"], properties:["aria-required"]}, range
:{"abstract":!0, namefrom:["author"], parent:["widget"], properties:["aria-value
max", "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-flow
to aria-grabbed aria-haspopup aria-hidden aria-invalid aria-label aria-labelledb
y aria-live aria-owns aria-relevant".split(" ")}, | 435 namerequired:!0, parent:["select"], properties:["aria-required"]}, range:{"abstr
act":!0, namefrom:["author"], parent:["widget"], properties:["aria-valuemax", "a
ria-valuemin", "aria-valuenow", "aria-valuetext"]}, region:{namefrom:[" author"]
, parent:["section"]}, roletype:{"abstract":!0, properties:"aria-atomic aria-bus
y aria-controls aria-describedby aria-disabled aria-dropeffect aria-flowto aria-
grabbed aria-haspopup aria-hidden aria-invalid aria-label aria-labelledby aria-l
ive aria-owns aria-relevant".split(" ")}, |
437 row:{mustcontain:["columnheader", "gridcell", "rowheader"], namefrom:["contents"
, "author"], parent:["group", "widget"], properties:["aria-level", "aria-selecte
d"], scope:["grid", "rowgroup", "treegrid"]}, rowgroup:{mustcontain:["row"], nam
efrom:["contents", "author"], parent:["group"], scope:["grid"]}, rowheader:{name
from:["contents", "author"], namerequired:!0, parent:["gridcell", "sectionhead",
"widget"], properties:["aria-sort"], scope:["row"]}, search:{namefrom:["author"
], parent:["landmark"]}, | 436 row:{mustcontain:["columnheader", "gridcell", "rowheader"], namefrom:["contents"
, "author"], parent:["group", "widget"], properties:["aria-level", "aria-selecte
d"]}, rowgroup:{mustcontain:["row"], namefrom:["contents", "author"], parent:["g
roup"]}, rowheader:{namefrom:["contents", "author"], namerequired:!0, parent:["g
ridcell", "sectionhead", "widget"], properties:["aria-sort"]}, search:{namefrom:
["author"], parent:["landmark"]}, section:{"abstract":!0, namefrom:["contents",
"author"], parent:["structure"], |
438 section:{"abstract":!0, namefrom:["contents", "author"], parent:["structure"], p
roperties:["aria-expanded"]}, sectionhead:{"abstract":!0, namefrom:["contents",
"author"], parent:["structure"], properties:["aria-expanded"]}, select:{"abstrac
t":!0, namefrom:["author"], parent:["composite", "group", "input"]}, separator:{
childpresentational:!0, namefrom:["author"], parent:["structure"], properties:["
aria-expanded", "aria-orientation"]}, scrollbar:{childpresentational:!0, namefro
m:["author"], namerequired:!1, | 437 properties:["aria-expanded"]}, sectionhead:{"abstract":!0, namefrom:["contents",
"author"], parent:["structure"], properties:["aria-expanded"]}, select:{"abstra
ct":!0, namefrom:["author"], parent:["composite", "group", "input"]}, separator:
{childpresentational:!0, namefrom:["author"], parent:["structure"], properties:[
"aria-expanded", "aria-orientation"]}, scrollbar:{childpresentational:!0, namefr
om:["author"], namerequired:!1, parent:["input", "range"], requiredProperties:["
aria-controls", "aria-orientation", |
439 parent:["input", "range"], requiredProperties:["aria-controls", "aria-orientatio
n", "aria-valuemax", "aria-valuemin", "aria-valuenow"], properties:["aria-contro
ls", "aria-orientation", "aria-valuemax", "aria-valuemin", "aria-valuenow"]}, sl
ider:{childpresentational:!0, namefrom:["author"], namerequired:!0, parent:["inp
ut", "range"], requiredProperties:["aria-valuemax", "aria-valuemin", "aria-value
now"], properties:["aria-valuemax", "aria-valuemin", "aria-valuenow", "aria-orie
ntation"]}, spinbutton:{namefrom:["author"], | 438 "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-orientat
ion"]}, spinbutton:{namefrom:["author"], namerequired:!0, parent:["input", "rang
e"], requiredProperties:["aria-valuemax", |
440 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:{"ab
stract":!0, parent:["roletype"]}, tab:{namefrom:["contents", "author"], parent:[
"sectionhead", "widget"], properties:["aria-selected"], scope:["tablist"]}, tabl
ist:{mustcontain:["tab"], namefrom:["author"], parent:["composite", "directory"]
, properties:["aria-level"]}, | 439 "aria-valuemin", "aria-valuenow"], properties:["aria-valuemax", "aria-valuemin",
"aria-valuenow", "aria-required"]}, status:{parent:["region"]}, structure:{"abs
tract":!0, parent:["roletype"]}, tab:{namefrom:["contents", "author"], parent:["
sectionhead", "widget"], properties:["aria-selected"]}, tablist:{mustcontain:["t
ab"], namefrom:["author"], parent:["composite", "directory"], properties:["aria-
level"]}, tabpanel:{namefrom:["author"], namerequired:!0, parent:["region"]}, te
xtbox:{namefrom:["author"], |
441 tabpanel:{namefrom:["author"], namerequired:!0, parent:["region"]}, textbox:{nam
efrom:["author"], namerequired:!0, parent:["input"], properties:["aria-activedes
cendant", "aria-autocomplete", "aria-multiline", "aria-readonly", "aria-required
"]}, timer:{namefrom:["author"], namerequired:!0, parent:["status"]}, toolbar:{n
amefrom:["author"], parent:["group"]}, tooltip:{namerequired:!0, parent:["sectio
n"]}, tree:{mustcontain:["group", "treeitem"], namefrom:["author"], namerequired
:!0, parent:["select"], | 440 namerequired:!0, parent:["input"], properties:["aria-activedescendant", "aria-au
tocomplete", "aria-multiline", "aria-readonly", "aria-required"]}, timer:{namefr
om:["author"], namerequired:!0, parent:["status"]}, toolbar:{namefrom:["author"]
, parent:["group"]}, tooltip:{namerequired:!0, parent:["section"]}, tree:{mustco
ntain:["group", "treeitem"], namefrom:["author"], namerequired:!0, parent:["sele
ct"], properties:["aria-multiselectable", "aria-required"]}, treegrid:{mustconta
in:["row"], namefrom:["author"], |
442 properties:["aria-multiselectable", "aria-required"]}, treegrid:{mustcontain:["r
ow"], 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-expa
nded"]}}; | 441 namerequired:!0, parent:["grid", "tree"]}, treeitem:{namefrom:["contents", "auth
or"], namerequired:!0, parent:["listitem", "option"]}, widget:{"abstract":!0, pa
rent:["roletype"]}, window:{"abstract":!0, namefrom:[" author"], parent:["rolety
pe"], properties:["aria-expanded"]}}; |
443 axs.constants.WIDGET_ROLES = {}; | 442 axs.constants.WIDGET_ROLES = {}; |
444 axs.constants.addAllParentRolesToSet_ = function(a, b) { | 443 axs.constants.addAllParentRolesToSet_ = function(a, b) { |
445 if (a.parent) { | 444 if (a.parent) { |
446 for (var c = a.parent, d = 0;d < c.length;d++) { | 445 for (var c = a.parent, d = 0;d < c.length;d++) { |
447 var e = c[d]; | 446 var e = c[d]; |
448 b[e] = !0; | 447 b[e] = !0; |
449 axs.constants.addAllParentRolesToSet_(axs.constants.ARIA_ROLES[e], b); | 448 axs.constants.addAllParentRolesToSet_(axs.constants.ARIA_ROLES[e], b); |
450 } | 449 } |
451 } | 450 } |
452 }; | 451 }; |
(...skipping 21 matching lines...) Expand all Loading... |
474 axs.constants.addAllParentRolesToSet_(role, parentRolesSet); | 473 axs.constants.addAllParentRolesToSet_(role, parentRolesSet); |
475 role.allParentRolesSet = parentRolesSet; | 474 role.allParentRolesSet = parentRolesSet; |
476 "widget" in parentRolesSet && (axs.constants.WIDGET_ROLES[roleName] = role); | 475 "widget" in parentRolesSet && (axs.constants.WIDGET_ROLES[roleName] = role); |
477 } | 476 } |
478 axs.constants.ARIA_PROPERTIES = {activedescendant:{type:"property", valueType:"i
dref"}, atomic:{defaultValue:"false", type:"property", valueType:"boolean"}, aut
ocomplete:{defaultValue:"none", type:"property", valueType:"token", values:["inl
ine", "list", "both", "none"]}, busy:{defaultValue:"false", type:"state", valueT
ype:"boolean"}, checked:{defaultValue:"undefined", type:"state", valueType:"toke
n", values:["true", "false", "mixed", "undefined"]}, controls:{type:"property",
valueType:"idref_list"}, | 477 axs.constants.ARIA_PROPERTIES = {activedescendant:{type:"property", valueType:"i
dref"}, atomic:{defaultValue:"false", type:"property", valueType:"boolean"}, aut
ocomplete:{defaultValue:"none", type:"property", valueType:"token", values:["inl
ine", "list", "both", "none"]}, busy:{defaultValue:"false", type:"state", valueT
ype:"boolean"}, checked:{defaultValue:"undefined", type:"state", valueType:"toke
n", values:["true", "false", "mixed", "undefined"]}, controls:{type:"property",
valueType:"idref_list"}, |
479 describedby:{type:"property", valueType:"idref_list"}, disabled:{defaultValue:"f
alse", 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:"id
ref_list"}, grabbed:{defaultValue:"undefined", type:"state", valueType:"token",
values:["true", "false", | 478 describedby:{type:"property", valueType:"idref_list"}, disabled:{defaultValue:"f
alse", 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:"id
ref_list"}, grabbed:{defaultValue:"undefined", type:"state", valueType:"token",
values:["true", "false", |
480 "undefined"]}, haspopup:{defaultValue:"false", type:"property", valueType:"boole
an"}, hidden:{defaultValue:"false", type:"state", valueType:"boolean"}, invalid:
{defaultValue:"false", type:"state", valueType:"token", values:["grammar", "fals
e", "spelling", "true"]}, label:{type:"property", valueType:"string"}, labelledb
y:{type:"property", valueType:"idref_list"}, level:{type:"property", valueType:"
integer"}, live:{defaultValue:"off", type:"property", valueType:"token", values:
["off", "polite", "assertive"]}, | 479 "undefined"]}, haspopup:{defaultValue:"false", type:"property", valueType:"boole
an"}, hidden:{defaultValue:"false", type:"state", valueType:"boolean"}, invalid:
{defaultValue:"false", type:"state", valueType:"token", values:["grammar", "fals
e", "spelling", "true"]}, label:{type:"property", valueType:"string"}, labelledb
y:{type:"property", valueType:"idref_list"}, level:{type:"property", valueType:"
integer"}, live:{defaultValue:"off", type:"property", valueType:"token", values:
["off", "polite", "assertive"]}, |
481 multiline:{defaultValue:"false", type:"property", valueType:"boolean"}, multisel
ectable:{defaultValue:"false", type:"property", valueType:"boolean"}, orientatio
n:{defaultValue:"vertical", type:"property", valueType:"token", values:["horizon
tal", "vertical"]}, owns:{type:"property", valueType:"idref_list"}, posinset:{ty
pe:"property", valueType:"integer"}, pressed:{defaultValue:"undefined", type:"st
ate", valueType:"token", values:["true", "false", "mixed", "undefined"]}, readon
ly:{defaultValue:"false", | 480 multiline:{defaultValue:"false", type:"property", valueType:"boolean"}, multisel
ectable:{defaultValue:"false", type:"property", valueType:"boolean"}, orientatio
n:{defaultValue:"vertical", type:"property", valueType:"token", values:["horizon
tal", "vertical"]}, owns:{type:"property", valueType:"idref_list"}, posinset:{ty
pe:"property", valueType:"integer"}, pressed:{defaultValue:"undefined", type:"st
ate", valueType:"token", values:["true", "false", "mixed", "undefined"]}, readon
ly:{defaultValue:"false", |
482 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"}, s
ort:{defaultValue:"none", type:"property", valueType:"token", values:["ascending
", "descending", "none", | 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"}, s
ort:{defaultValue:"none", type:"property", valueType:"token", values:["ascending
", "descending", "none", |
483 "other"]}, valuemax:{type:"property", valueType:"decimal"}, valuemin:{type:"prop
erty", valueType:"decimal"}, valuenow:{type:"property", valueType:"decimal"}, va
luetext:{type:"property", valueType:"string"}}; | 482 "other"]}, valuemax:{type:"property", valueType:"decimal"}, valuemin:{type:"prop
erty", valueType:"decimal"}, valuenow:{type:"property", valueType:"decimal"}, va
luetext:{type:"property", valueType:"string"}}; |
484 (function() { | 483 axs.constants.GLOBAL_PROPERTIES = "aria-atomic aria-busy aria-controls aria-desc
ribedby aria-disabled aria-dropeffect aria-flowto aria-grabbed aria-haspopup ari
a-hidden aria-invalid aria-label aria-labelledby aria-live aria-owns aria-releva
nt".split(" "); |
485 for (var a in axs.constants.ARIA_PROPERTIES) { | |
486 var b = axs.constants.ARIA_PROPERTIES[a]; | |
487 if (b.values) { | |
488 for (var c = {}, d = 0;d < b.values.length;d++) { | |
489 c[b.values[d]] = !0; | |
490 } | |
491 b.valuesSet = c; | |
492 } | |
493 } | |
494 })(); | |
495 axs.constants.GLOBAL_PROPERTIES = axs.constants.ARIA_ROLES.roletype.propertiesSe
t; | |
496 axs.constants.NO_ROLE_NAME = " "; | 484 axs.constants.NO_ROLE_NAME = " "; |
497 axs.constants.WIDGET_ROLE_TO_NAME = {alert:"aria_role_alert", alertdialog:"aria_
role_alertdialog", button:"aria_role_button", checkbox:"aria_role_checkbox", col
umnheader:"aria_role_columnheader", combobox:"aria_role_combobox", dialog:"aria_
role_dialog", grid:"aria_role_grid", gridcell:"aria_role_gridcell", link:"aria_r
ole_link", listbox:"aria_role_listbox", log:"aria_role_log", marquee:"aria_role_
marquee", menu:"aria_role_menu", menubar:"aria_role_menubar", menuitem:"aria_rol
e_menuitem", menuitemcheckbox:"aria_role_menuitemcheckbox", | 485 axs.constants.WIDGET_ROLE_TO_NAME = {alert:"aria_role_alert", alertdialog:"aria_
role_alertdialog", button:"aria_role_button", checkbox:"aria_role_checkbox", col
umnheader:"aria_role_columnheader", combobox:"aria_role_combobox", dialog:"aria_
role_dialog", grid:"aria_role_grid", gridcell:"aria_role_gridcell", link:"aria_r
ole_link", listbox:"aria_role_listbox", log:"aria_role_log", marquee:"aria_role_
marquee", menu:"aria_role_menu", menubar:"aria_role_menubar", menuitem:"aria_rol
e_menuitem", menuitemcheckbox:"aria_role_menuitemcheckbox", |
498 menuitemradio:"aria_role_menuitemradio", option:axs.constants.NO_ROLE_NAME, prog
ressbar:"aria_role_progressbar", radio:"aria_role_radio", radiogroup:"aria_role_
radiogroup", rowheader:"aria_role_rowheader", scrollbar:"aria_role_scrollbar", s
lider:"aria_role_slider", spinbutton:"aria_role_spinbutton", status:"aria_role_s
tatus", tab:"aria_role_tab", tabpanel:"aria_role_tabpanel", textbox:"aria_role_t
extbox", timer:"aria_role_timer", toolbar:"aria_role_toolbar", tooltip:"aria_rol
e_tooltip", treeitem:"aria_role_treeitem"}; | 486 menuitemradio:"aria_role_menuitemradio", option:axs.constants.NO_ROLE_NAME, prog
ressbar:"aria_role_progressbar", radio:"aria_role_radio", radiogroup:"aria_role_
radiogroup", rowheader:"aria_role_rowheader", scrollbar:"aria_role_scrollbar", s
lider:"aria_role_slider", spinbutton:"aria_role_spinbutton", status:"aria_role_s
tatus", tab:"aria_role_tab", tabpanel:"aria_role_tabpanel", textbox:"aria_role_t
extbox", timer:"aria_role_timer", toolbar:"aria_role_toolbar", tooltip:"aria_rol
e_tooltip", treeitem:"aria_role_treeitem"}; |
499 axs.constants.STRUCTURE_ROLE_TO_NAME = {article:"aria_role_article", application
:"aria_role_application", banner:"aria_role_banner", columnheader:"aria_role_col
umnheader", complementary:"aria_role_complementary", contentinfo:"aria_role_cont
entinfo", definition:"aria_role_definition", directory:"aria_role_directory", do
cument:"aria_role_document", form:"aria_role_form", group:"aria_role_group", hea
ding:"aria_role_heading", img:"aria_role_img", list:"aria_role_list", listitem:"
aria_role_listitem", | 487 axs.constants.STRUCTURE_ROLE_TO_NAME = {article:"aria_role_article", application
:"aria_role_application", banner:"aria_role_banner", columnheader:"aria_role_col
umnheader", complementary:"aria_role_complementary", contentinfo:"aria_role_cont
entinfo", definition:"aria_role_definition", directory:"aria_role_directory", do
cument:"aria_role_document", form:"aria_role_form", group:"aria_role_group", hea
ding:"aria_role_heading", img:"aria_role_img", list:"aria_role_list", listitem:"
aria_role_listitem", |
500 main:"aria_role_main", math:"aria_role_math", navigation:"aria_role_navigation",
note:"aria_role_note", region:"aria_role_region", rowheader:"aria_role_rowheade
r", search:"aria_role_search", separator:"aria_role_separator"}; | 488 main:"aria_role_main", math:"aria_role_math", navigation:"aria_role_navigation",
note:"aria_role_note", region:"aria_role_region", rowheader:"aria_role_rowheade
r", search:"aria_role_search", separator:"aria_role_separator"}; |
501 axs.constants.ATTRIBUTE_VALUE_TO_STATUS = [{name:"aria-autocomplete", values:{in
line:"aria_autocomplete_inline", list:"aria_autocomplete_list", both:"aria_autoc
omplete_both"}}, {name:"aria-checked", values:{"true":"aria_checked_true", "fals
e":"aria_checked_false", mixed:"aria_checked_mixed"}}, {name:"aria-disabled", va
lues:{"true":"aria_disabled_true"}}, {name:"aria-expanded", values:{"true":"aria
_expanded_true", "false":"aria_expanded_false"}}, {name:"aria-invalid", values:{
"true":"aria_invalid_true", | 489 axs.constants.ATTRIBUTE_VALUE_TO_STATUS = [{name:"aria-autocomplete", values:{in
line:"aria_autocomplete_inline", list:"aria_autocomplete_list", both:"aria_autoc
omplete_both"}}, {name:"aria-checked", values:{"true":"aria_checked_true", "fals
e":"aria_checked_false", mixed:"aria_checked_mixed"}}, {name:"aria-disabled", va
lues:{"true":"aria_disabled_true"}}, {name:"aria-expanded", values:{"true":"aria
_expanded_true", "false":"aria_expanded_false"}}, {name:"aria-invalid", values:{
"true":"aria_invalid_true", |
502 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:{"t
rue":"aria_pressed_true", "false":"aria_pressed_false", mixed:"aria_pressed_mixe
d"}}, {name:"aria-readonly", values:{"true":"aria_readonly_true"}}, {name:"aria-
required", values:{"true":"aria_required_true"}}, {name:"aria-selected", values:
{"true":"aria_selected_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:{"t
rue":"aria_pressed_true", "false":"aria_pressed_false", mixed:"aria_pressed_mixe
d"}}, {name:"aria-readonly", values:{"true":"aria_readonly_true"}}, {name:"aria-
required", values:{"true":"aria_required_true"}}, {name:"aria-selected", values:
{"true":"aria_selected_true", |
503 "false":"aria_selected_false"}}]; | 491 "false":"aria_selected_false"}}]; |
504 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", mon
th:"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", | 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", mon
th:"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", |
505 submit:"input_type_submit", tel:"input_type_tel", text:"input_type_text", url:"i
nput_type_url", week:"input_type_week"}; | 493 submit:"input_type_submit", tel:"input_type_tel", text:"input_type_text", url:"i
nput_type_url", week:"input_type_week"}; |
506 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:"ta
g_h6", LI:"tag_li", OL:"tag_ol", SELECT:"tag_select", TEXTAREA:"tag_textarea", U
L:"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"}; | 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:"ta
g_h6", LI:"tag_li", OL:"tag_ol", SELECT:"tag_select", TEXTAREA:"tag_textarea", U
L:"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"}; |
507 axs.constants.TAG_TO_INFORMATION_TABLE_BRIEF_MSG = {BUTTON:"tag_button", SELECT:
"tag_select", TEXTAREA:"tag_textarea"}; | 495 axs.constants.TAG_TO_INFORMATION_TABLE_BRIEF_MSG = {BUTTON:"tag_button", SELECT:
"tag_select", TEXTAREA:"tag_textarea"}; |
508 axs.constants.MIXED_VALUES = {"true":!0, "false":!0, mixed:!0}; | 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 })(); |
509 axs.constants.Severity = {INFO:"Info", WARNING:"Warning", SEVERE:"Severe"}; | 508 axs.constants.Severity = {INFO:"Info", WARNING:"Warning", SEVERE:"Severe"}; |
510 axs.constants.AuditResult = {PASS:"PASS", FAIL:"FAIL", NA:"NA"}; | 509 axs.constants.AuditResult = {PASS:"PASS", FAIL:"FAIL", NA:"NA"}; |
511 axs.constants.InlineElements = {TT:!0, I:!0, B:!0, BIG:!0, SMALL:!0, EM:!0, STRO
NG:!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}; | 510 axs.constants.InlineElements = {TT:!0, I:!0, B:!0, BIG:!0, SMALL:!0, EM:!0, STRO
NG:!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}; |
512 axs.constants.NATIVELY_DISABLEABLE = {BUTTON:!0, INPUT:!0, SELECT:!0, TEXTAREA:!
0, FIELDSET:!0, OPTGROUP:!0, OPTION:!0}; | 511 axs.utils = {}; |
513 axs.constants.ARIA_TO_HTML_ATTRIBUTE = {"aria-checked":"checked", "aria-disabled
":"disabled", "aria-hidden":"hidden", "aria-expanded":"open", "aria-valuemax":"m
ax", "aria-valuemin":"min", "aria-readonly":"readonly", "aria-required":"require
d", "aria-selected":"selected", "aria-valuenow":"value"}; | 512 axs.utils.FOCUSABLE_ELEMENTS_SELECTOR = "input:not([type=hidden]):not([disabled]
),select:not([disabled]),textarea:not([disabled]),button:not([disabled]),a[href]
,iframe,[tabindex]"; |
514 axs.constants.TAG_TO_IMPLICIT_SEMANTIC_INFO = {A:[{role:"link", allowed:"button
checkbox menuitem menuitemcheckbox menuitemradio tab treeitem".split(" "), selec
tor:"a[href]"}], ADDRESS:[{role:"", allowed:["contentinfo", "presentation"]}], A
REA:[{role:"link", selector:"area[href]"}], ARTICLE:[{role:"article", allowed:["
presentation", "article", "document", "application", "main"]}], ASIDE:[{role:"co
mplementary", allowed:["note", "complementary", "search", "presentation"]}], AUD
IO:[{role:"", allowed:["application", | 513 axs.utils.Color = function(a, b, c, d) { |
515 "presentation"]}], BASE:[{role:"", reserved:!0}], BODY:[{role:"document", allowe
d:["presentation"]}], BUTTON:[{role:"button", allowed:["link", "menuitem", "menu
itemcheckbox", "menuitemradio", "radio"], selector:'button:not([aria-pressed]):n
ot([type="menu"])'}, {role:"button", allowed:["button"], selector:"button[aria-p
ressed]"}, {role:"button", attributes:{"aria-haspopup":!0}, allowed:["link", "me
nuitem", "menuitemcheckbox", "menuitemradio", "radio"], selector:'button[type="m
enu"]'}], CAPTION:[{role:"", | |
516 allowed:["presentation"]}], COL:[{role:"", reserved:!0}], COLGROUP:[{role:"", re
served:!0}], DATALIST:[{role:"listbox", attributes:{"aria-multiselectable":!1},
allowed:["presentation"]}], DEL:[{role:"", allowed:["*"]}], DD:[{role:"", allowe
d:["presentation"]}], DT:[{role:"", allowed:["presentation"]}], DETAILS:[{role:"
group", allowed:["group", "presentation"]}], DIALOG:[{role:"dialog", allowed:"di
alog alert alertdialog application log marquee status".split(" "), selector:"dia
log[open]"}, {role:"dialog", | |
517 attributes:{"aria-hidden":!0}, allowed:"dialog alert alertdialog application log
marquee status".split(" "), selector:"dialog:not([open])"}], DIV:[{role:"", all
owed:["*"]}], DL:[{role:"list", allowed:["presentation"]}], EMBED:[{role:"", all
owed:["application", "document", "img", "presentation"]}], FIGURE:[{role:"", all
owed:["*"]}], FOOTER:[{role:"", allowed:["contentinfo", "presentation"]}], FORM:
[{role:"form", allowed:["presentation"]}], P:[{role:"", allowed:["*"]}], PRE:[{r
ole:"", allowed:["*"]}], | |
518 BLOCKQUOTE:[{role:"", allowed:["*"]}], H1:[{role:"heading"}], H2:[{role:"heading
"}], H3:[{role:"heading"}], H4:[{role:"heading"}], H5:[{role:"heading"}], H6:[{r
ole:"heading"}], HEAD:[{role:"", reserved:!0}], HEADER:[{role:"", allowed:["bann
er", "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", | |
519 "img", "presentation", "group"], selector:"iframe[seamless]"}], IMG:[{role:"pres
entation", reserved:!0, selector:'img[alt=""]'}, {role:"img", allowed:["*"], sel
ector:'img[alt]:not([alt=""])'}], INPUT:[{role:"button", allowed:["link", "menui
tem", "menuitemcheckbox", "menuitemradio", "radio"], selector:'input[type="butto
n"]:not([aria-pressed])'}, {role:"button", allowed:["button"], selector:'input[t
ype="button"][aria-pressed]'}, {role:"checkbox", allowed:["checkbox"], selector:
'input[type="checkbox"]'}, | |
520 {role:"", selector:'input[type="color"]'}, {role:"", selector:'input[type="date"
]'}, {role:"", selector:'input[type="datetime"]'}, {role:"textbox", selector:'in
put[type="email"]:not([list])'}, {role:"", selector:'input[type="file"]'}, {role
:"", reserved:!0, selector:'input[type="hidden"]'}, {role:"button", allowed:["bu
tton"], selector:'input[type="image"][aria-pressed]'}, {role:"button", allowed:[
"link", "menuitem", "menuitemcheckbox", "menuitemradio", "radio"], selector:'inp
ut[type="image"]:not([aria-pressed])'}, | |
521 {role:"", selector:'input[type="month"]'}, {role:"", selector:'input[type="numbe
r"]'}, {role:"textbox", selector:'input[type="password"]'}, {role:"radio", allow
ed:["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:'in
put[type="search"]:not([list])'}, {role:"button", selector:'input[type="submit"]
'}, {role:"combobox", | |
522 selector:'input[type="tel"][list]'}, {role:"textbox", selector:'input[type="tel"
]:not([list])'}, {role:"combobox", selector:'input[type="text"][list]'}, {role:"
textbox", selector:'input[type="text"]:not([list])'}, {role:"textbox", selector:
"input:not([type])"}, {role:"", selector:'input[type="time"]'}, {role:"combobox"
, selector:'input[type="url"][list]'}, {role:"textbox", selector:'input[type="ur
l"]:not([list])'}, {role:"", selector:'input[type="week"]'}], INS:[{role:"", all
owed:["*"]}], KEYGEN:[{role:""}], | |
523 LABEL:[{role:"", allowed:["presentation"]}], LI:[{role:"listitem", allowed:"menu
item 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 op
tion tab treeitem presentation".split(" "), selector:'ol[role="presentation"]>li
, ul[role="presentation"]>li'}], LINK:[{role:"link", reserved:!0, selector:"link
[href]"}], MAIN:[{role:"", | |
524 allowed:["main", "presentation"]}], MAP:[{role:"", reserved:!0}], MATH:[{role:""
, allowed:["presentation"]}], MENU:[{role:"toolbar", selector:'menu[type="toolba
r"]'}], MENUITEM:[{role:"menuitem", selector:'menuitem[type="command"]'}, {role:
"menuitemcheckbox", selector:'menuitem[type="checkbox"]'}, {role:"menuitemradio"
, selector:'menuitem[type="radio"]'}], META:[{role:"", reserved:!0}], METER:[{ro
le:"progressbar", allowed:["presentation"]}], NAV:[{role:"navigation", allowed:[
"navigation", "presentation"]}], | |
525 NOSCRIPT:[{role:"", reserved:!0}], OBJECT:[{role:"", allowed:["application", "do
cument", "img", "presentation"]}], OL:[{role:"list", allowed:"directory group li
stbox menu menubar tablist toolbar tree presentation".split(" ")}], OPTGROUP:[{r
ole:"", allowed:["presentation"]}], OPTION:[{role:"option"}], OUTPUT:[{role:"sta
tus", allowed:["*"]}], PARAM:[{role:"", reserved:!0}], PICTURE:[{role:"", reserv
ed:!0}], PROGRESS:[{role:"progressbar", allowed:["presentation"]}], SCRIPT:[{rol
e:"", reserved:!0}], | |
526 SECTION:[{role:"region", allowed:"alert alertdialog application contentinfo dial
og document log marquee search status presentation".split(" ")}], SELECT:[{role:
"listbox"}], SOURCE:[{role:"", reserved:!0}], SPAN:[{role:"", allowed:["*"]}], S
TYLE:[{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", | |
527 allowed:["*"]}], THEAD:[{role:"rowgroup", allowed:["*"]}], TFOOT:[{role:"rowgrou
p", allowed:["*"]}], TITLE:[{role:"", reserved:!0}], TD:[{role:"", allowed:["*"]
}], TH:[{role:"", allowed:["*"]}], TR:[{role:"", allowed:["*"]}], TRACK:[{role:"
", reserved:!0}], UL:[{role:"list", allowed:"directory group listbox menu menuba
r tablist toolbar tree presentation".split(" ")}], VIDEO:[{role:"", allowed:["ap
plication", "presentation"]}]}; | |
528 axs.color = {}; | |
529 axs.color.Color = function(a, b, c, d) { | |
530 this.red = a; | 514 this.red = a; |
531 this.green = b; | 515 this.green = b; |
532 this.blue = c; | 516 this.blue = c; |
533 this.alpha = d; | 517 this.alpha = d; |
534 }; | 518 }; |
535 axs.color.YCbCr = function(a) { | 519 axs.utils.calculateContrastRatio = function(a, b) { |
536 this.luma = this.z = a[0]; | 520 if (!a || !b) { |
537 this.Cb = this.x = a[1]; | 521 return null; |
538 this.Cr = this.y = a[2]; | 522 } |
| 523 1 > a.alpha && (a = axs.utils.flattenColors(a, b)); |
| 524 var c = axs.utils.calculateLuminance(a), d = axs.utils.calculateLuminance(b); |
| 525 return(Math.max(c, d) + .05) / (Math.min(c, d) + .05); |
539 }; | 526 }; |
540 axs.color.YCbCr.prototype = {multiply:function(a) { | 527 axs.utils.luminanceRatio = function(a, b) { |
541 return new axs.color.YCbCr([this.luma * a, this.Cb * a, this.Cr * a]); | 528 return(Math.max(a, b) + .05) / (Math.min(a, b) + .05); |
542 }, add:function(a) { | |
543 return new axs.color.YCbCr([this.luma + a.luma, this.Cb + a.Cb, this.Cr + a.Cr
]); | |
544 }, subtract:function(a) { | |
545 return new axs.color.YCbCr([this.luma - a.luma, this.Cb - a.Cb, this.Cr - a.Cr
]); | |
546 }}; | |
547 axs.color.calculateContrastRatio = function(a, b) { | |
548 1 > a.alpha && (a = axs.color.flattenColors(a, b)); | |
549 var c = axs.color.calculateLuminance(a), d = axs.color.calculateLuminance(b); | |
550 return (Math.max(c, d) + .05) / (Math.min(c, d) + .05); | |
551 }; | 529 }; |
552 axs.color.calculateLuminance = function(a) { | 530 axs.utils.parentElement = function(a) { |
553 return axs.color.toYCbCr(a).luma; | |
554 }; | |
555 axs.color.luminanceRatio = function(a, b) { | |
556 return (Math.max(a, b) + .05) / (Math.min(a, b) + .05); | |
557 }; | |
558 axs.color.parseColor = function(a) { | |
559 if ("transparent" === a) { | |
560 return new axs.color.Color(0, 0, 0, 0); | |
561 } | |
562 var b = a.match(/^rgb\((\d+), (\d+), (\d+)\)$/); | |
563 if (b) { | |
564 a = parseInt(b[1], 10); | |
565 var c = parseInt(b[2], 10), d = parseInt(b[3], 10); | |
566 return new axs.color.Color(a, c, d, 1); | |
567 } | |
568 return (b = a.match(/^rgba\((\d+), (\d+), (\d+), (\d*(\.\d+)?)\)/)) ? (a = par
seInt(b[1], 10), c = parseInt(b[2], 10), d = parseInt(b[3], 10), b = parseFloat(
b[4]), new axs.color.Color(a, c, d, b)) : null; | |
569 }; | |
570 axs.color.colorChannelToString = function(a) { | |
571 a = Math.round(a); | |
572 return 15 >= a ? "0" + a.toString(16) : a.toString(16); | |
573 }; | |
574 axs.color.colorToString = function(a) { | |
575 return 1 == a.alpha ? "#" + axs.color.colorChannelToString(a.red) + axs.color.
colorChannelToString(a.green) + axs.color.colorChannelToString(a.blue) : "rgba("
+ [a.red, a.green, a.blue, a.alpha].join() + ")"; | |
576 }; | |
577 axs.color.luminanceFromContrastRatio = function(a, b, c) { | |
578 return c ? (a + .05) * b - .05 : (a + .05) / b - .05; | |
579 }; | |
580 axs.color.translateColor = function(a, b) { | |
581 for (var c = b > a.luma ? axs.color.WHITE_YCC : axs.color.BLACK_YCC, d = c ==
axs.color.WHITE_YCC ? axs.color.YCC_CUBE_FACES_WHITE : axs.color.YCC_CUBE_FACES_
BLACK, e = new axs.color.YCbCr([0, a.Cb, a.Cr]), f = new axs.color.YCbCr([1, a.C
b, a.Cr]), f = {a:e, b:f}, e = null, g = 0;g < d.length && !(e = axs.color.findI
ntersection(f, d[g]), 0 <= e.z && 1 >= e.z);g++) { | |
582 } | |
583 if (!e) { | |
584 throw "Couldn't find intersection with YCbCr color cube for Cb=" + a.Cb + ",
Cr=" + a.Cr + "."; | |
585 } | |
586 if (e.x != a.x || e.y != a.y) { | |
587 throw "Intersection has wrong Cb/Cr values."; | |
588 } | |
589 if (Math.abs(c.luma - e.luma) < Math.abs(c.luma - b)) { | |
590 return c = [b, a.Cb, a.Cr], axs.color.fromYCbCrArray(c); | |
591 } | |
592 c = (b - e.luma) / (c.luma - e.luma); | |
593 c = [b, e.Cb - e.Cb * c, e.Cr - e.Cr * c]; | |
594 return axs.color.fromYCbCrArray(c); | |
595 }; | |
596 axs.color.suggestColors = function(a, b, c) { | |
597 var d = {}, e = axs.color.calculateLuminance(a), f = axs.color.calculateLumina
nce(b), g = f > e, h = axs.color.toYCbCr(b), k = axs.color.toYCbCr(a), m; | |
598 for (m in c) { | |
599 var l = c[m], n = axs.color.luminanceFromContrastRatio(e, l + .02, g); | |
600 if (1 >= n && 0 <= n) { | |
601 var p = axs.color.translateColor(h, n), l = axs.color.calculateContrastRat
io(p, a), n = {}; | |
602 n.fg = axs.color.colorToString(p); | |
603 n.bg = axs.color.colorToString(a); | |
604 n.contrast = l.toFixed(2); | |
605 d[m] = n; | |
606 } else { | |
607 l = axs.color.luminanceFromContrastRatio(f, l + .02, !g), 1 >= l && 0 <= l
&& (p = axs.color.translateColor(k, l), l = axs.color.calculateContrastRatio(b,
p), n = {}, n.bg = axs.color.colorToString(p), n.fg = axs.color.colorToString(b
), n.contrast = l.toFixed(2), d[m] = n); | |
608 } | |
609 } | |
610 return d; | |
611 }; | |
612 axs.color.flattenColors = function(a, b) { | |
613 var c = a.alpha; | |
614 return new axs.color.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)); | |
615 }; | |
616 axs.color.multiplyMatrixVector = function(a, b) { | |
617 var c = b[0], d = b[1], e = b[2]; | |
618 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]; | |
619 }; | |
620 axs.color.toYCbCr = function(a) { | |
621 var b = a.red / 255, c = a.green / 255; | |
622 a = a.blue / 255; | |
623 b = .03928 >= b ? b / 12.92 : Math.pow((b + .055) / 1.055, 2.4); | |
624 c = .03928 >= c ? c / 12.92 : Math.pow((c + .055) / 1.055, 2.4); | |
625 a = .03928 >= a ? a / 12.92 : Math.pow((a + .055) / 1.055, 2.4); | |
626 return new axs.color.YCbCr(axs.color.multiplyMatrixVector(axs.color.YCC_MATRIX
, [b, c, a])); | |
627 }; | |
628 axs.color.fromYCbCr = function(a) { | |
629 return axs.color.fromYCbCrArray([a.luma, a.Cb, a.Cr]); | |
630 }; | |
631 axs.color.fromYCbCrArray = function(a) { | |
632 var b = axs.color.multiplyMatrixVector(axs.color.INVERTED_YCC_MATRIX, a), c =
b[0]; | |
633 a = b[1]; | |
634 b = b[2]; | |
635 c = .00303949 >= c ? 12.92 * c : 1.055 * Math.pow(c, 1 / 2.4) - .055; | |
636 a = .00303949 >= a ? 12.92 * a : 1.055 * Math.pow(a, 1 / 2.4) - .055; | |
637 b = .00303949 >= b ? 12.92 * b : 1.055 * Math.pow(b, 1 / 2.4) - .055; | |
638 c = Math.min(Math.max(Math.round(255 * c), 0), 255); | |
639 a = Math.min(Math.max(Math.round(255 * a), 0), 255); | |
640 b = Math.min(Math.max(Math.round(255 * b), 0), 255); | |
641 return new axs.color.Color(c, a, b, 1); | |
642 }; | |
643 axs.color.RGBToYCbCrMatrix = function(a, b) { | |
644 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)]]; | |
645 }; | |
646 axs.color.invert3x3Matrix = function(a) { | |
647 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]; | |
648 a = a[2][2]; | |
649 return axs.color.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))); | |
650 }; | |
651 axs.color.findIntersection = function(a, b) { | |
652 var c = [a.a.x - b.p0.x, a.a.y - b.p0.y, a.a.z - b.p0.z], d = axs.color.invert
3x3Matrix([[a.a.x - a.b.x, b.p1.x - b.p0.x, b.p2.x - b.p0.x], [a.a.y - a.b.y, b.
p1.y - b.p0.y, b.p2.y - b.p0.y], [a.a.z - a.b.z, b.p1.z - b.p0.z, b.p2.z - b.p0.
z]]), c = axs.color.multiplyMatrixVector(d, c)[0]; | |
653 return a.a.add(a.b.subtract(a.a).multiply(c)); | |
654 }; | |
655 axs.color.scalarMultiplyMatrix = function(a, b) { | |
656 for (var c = [], d = 0;3 > d;d++) { | |
657 c[d] = axs.color.scalarMultiplyVector(a[d], b); | |
658 } | |
659 return c; | |
660 }; | |
661 axs.color.scalarMultiplyVector = function(a, b) { | |
662 for (var c = [], d = 0;d < a.length;d++) { | |
663 c[d] = a[d] * b; | |
664 } | |
665 return c; | |
666 }; | |
667 axs.color.kR = .2126; | |
668 axs.color.kB = .0722; | |
669 axs.color.YCC_MATRIX = axs.color.RGBToYCbCrMatrix(axs.color.kR, axs.color.kB); | |
670 axs.color.INVERTED_YCC_MATRIX = axs.color.invert3x3Matrix(axs.color.YCC_MATRIX); | |
671 axs.color.BLACK = new axs.color.Color(0, 0, 0, 1); | |
672 axs.color.BLACK_YCC = axs.color.toYCbCr(axs.color.BLACK); | |
673 axs.color.WHITE = new axs.color.Color(255, 255, 255, 1); | |
674 axs.color.WHITE_YCC = axs.color.toYCbCr(axs.color.WHITE); | |
675 axs.color.RED = new axs.color.Color(255, 0, 0, 1); | |
676 axs.color.RED_YCC = axs.color.toYCbCr(axs.color.RED); | |
677 axs.color.GREEN = new axs.color.Color(0, 255, 0, 1); | |
678 axs.color.GREEN_YCC = axs.color.toYCbCr(axs.color.GREEN); | |
679 axs.color.BLUE = new axs.color.Color(0, 0, 255, 1); | |
680 axs.color.BLUE_YCC = axs.color.toYCbCr(axs.color.BLUE); | |
681 axs.color.CYAN = new axs.color.Color(0, 255, 255, 1); | |
682 axs.color.CYAN_YCC = axs.color.toYCbCr(axs.color.CYAN); | |
683 axs.color.MAGENTA = new axs.color.Color(255, 0, 255, 1); | |
684 axs.color.MAGENTA_YCC = axs.color.toYCbCr(axs.color.MAGENTA); | |
685 axs.color.YELLOW = new axs.color.Color(255, 255, 0, 1); | |
686 axs.color.YELLOW_YCC = axs.color.toYCbCr(axs.color.YELLOW); | |
687 axs.color.YCC_CUBE_FACES_BLACK = [{p0:axs.color.BLACK_YCC, p1:axs.color.RED_YCC,
p2:axs.color.GREEN_YCC}, {p0:axs.color.BLACK_YCC, p1:axs.color.GREEN_YCC, p2:ax
s.color.BLUE_YCC}, {p0:axs.color.BLACK_YCC, p1:axs.color.BLUE_YCC, p2:axs.color.
RED_YCC}]; | |
688 axs.color.YCC_CUBE_FACES_WHITE = [{p0:axs.color.WHITE_YCC, p1:axs.color.CYAN_YCC
, p2:axs.color.MAGENTA_YCC}, {p0:axs.color.WHITE_YCC, p1:axs.color.MAGENTA_YCC,
p2:axs.color.YELLOW_YCC}, {p0:axs.color.WHITE_YCC, p1:axs.color.YELLOW_YCC, p2:a
xs.color.CYAN_YCC}]; | |
689 axs.dom = {}; | |
690 axs.dom.parentElement = function(a) { | |
691 if (!a) { | 531 if (!a) { |
692 return null; | 532 return null; |
693 } | 533 } |
694 a = axs.dom.composedParentNode(a); | 534 if (a.nodeType == Node.DOCUMENT_FRAGMENT_NODE) { |
| 535 return a.host; |
| 536 } |
| 537 var b = a.parentElement; |
| 538 if (b) { |
| 539 return b; |
| 540 } |
| 541 a = a.parentNode; |
695 if (!a) { | 542 if (!a) { |
696 return null; | 543 return null; |
697 } | 544 } |
698 switch(a.nodeType) { | 545 switch(a.nodeType) { |
699 case Node.ELEMENT_NODE: | 546 case Node.ELEMENT_NODE: |
700 return a; | 547 return a; |
| 548 case Node.DOCUMENT_FRAGMENT_NODE: |
| 549 return a.host; |
701 default: | 550 default: |
702 return axs.dom.parentElement(a); | 551 return null; |
703 } | 552 } |
704 }; | 553 }; |
705 axs.dom.shadowHost = function(a) { | 554 axs.utils.asElement = function(a) { |
706 return "host" in a ? a.host : null; | |
707 }; | |
708 axs.dom.composedParentNode = function(a) { | |
709 if (!a) { | |
710 return null; | |
711 } | |
712 if (a.nodeType === Node.DOCUMENT_FRAGMENT_NODE) { | |
713 return axs.dom.shadowHost(a); | |
714 } | |
715 var b = a.parentNode; | |
716 if (!b) { | |
717 return null; | |
718 } | |
719 if (b.nodeType === Node.DOCUMENT_FRAGMENT_NODE) { | |
720 return axs.dom.shadowHost(b); | |
721 } | |
722 if (!b.shadowRoot) { | |
723 return b; | |
724 } | |
725 a = a.getDestinationInsertionPoints(); | |
726 return 0 < a.length ? axs.dom.composedParentNode(a[a.length - 1]) : null; | |
727 }; | |
728 axs.dom.asElement = function(a) { | |
729 switch(a.nodeType) { | 555 switch(a.nodeType) { |
730 case Node.COMMENT_NODE: | 556 case Node.COMMENT_NODE: |
| 557 return null; |
| 558 case Node.ELEMENT_NODE: |
| 559 if ("script" == a.tagName.toLowerCase()) { |
| 560 return null; |
| 561 } |
731 break; | 562 break; |
732 case Node.ELEMENT_NODE: | |
733 if ("script" == a.localName || "template" == a.localName) { | |
734 break; | |
735 } | |
736 return a; | |
737 case Node.DOCUMENT_FRAGMENT_NODE: | |
738 return a.host; | |
739 case Node.TEXT_NODE: | 563 case Node.TEXT_NODE: |
740 return axs.dom.parentElement(a); | 564 a = axs.utils.parentElement(a); |
| 565 break; |
741 default: | 566 default: |
742 console.warn("Unhandled node type: ", a.nodeType); | 567 return console.warn("Unhandled node type: ", a.nodeType), null; |
743 } | 568 } |
744 return null; | 569 return a; |
745 }; | 570 }; |
746 axs.dom.composedTreeSearch = function(a, b, c, d) { | |
747 if (a === b) { | |
748 return !0; | |
749 } | |
750 if (a.nodeType == Node.ELEMENT_NODE) { | |
751 var e = a | |
752 } | |
753 var f = !1; | |
754 if (e && c.preorder && !c.preorder(e)) { | |
755 return f; | |
756 } | |
757 if (e) { | |
758 var g = e.shadowRoot || e.webkitShadowRoot; | |
759 if (g) { | |
760 return f = axs.dom.composedTreeSearch(g, b, c, g), e && c.postorder && !f
&& c.postorder(e), f; | |
761 } | |
762 } | |
763 if (e && "content" == e.localName) { | |
764 a = e.getDistributedNodes(); | |
765 for (g = 0;g < a.length && !f;g++) { | |
766 f = axs.dom.composedTreeSearch(a[g], b, c, d); | |
767 } | |
768 e && c.postorder && !f && c.postorder.call(null, e); | |
769 return f; | |
770 } | |
771 for (a = a.firstChild;null != a && !f;) { | |
772 f = axs.dom.composedTreeSearch(a, b, c, d), a = a.nextSibling; | |
773 } | |
774 e && c.postorder && !f && c.postorder.call(null, e); | |
775 return f; | |
776 }; | |
777 axs.utils = {}; | |
778 axs.utils.FOCUSABLE_ELEMENTS_SELECTOR = "input:not([type=hidden]):not([disabled]
),select:not([disabled]),textarea:not([disabled]),button:not([disabled]),a[href]
,iframe,[tabindex]"; | |
779 axs.utils.LABELABLE_ELEMENTS_SELECTOR = "button,input:not([type=hidden]),keygen,
meter,output,progress,select,textarea"; | |
780 axs.utils.elementIsTransparent = function(a) { | 571 axs.utils.elementIsTransparent = function(a) { |
781 return "0" == a.style.opacity; | 572 return "0" == a.style.opacity; |
782 }; | 573 }; |
783 axs.utils.elementHasZeroArea = function(a) { | 574 axs.utils.elementHasZeroArea = function(a) { |
784 a = a.getBoundingClientRect(); | 575 a = a.getBoundingClientRect(); |
785 var b = a.top - a.bottom; | 576 var b = a.top - a.bottom; |
786 return a.right - a.left && b ? !1 : !0; | 577 return a.right - a.left && b ? !1 : !0; |
787 }; | 578 }; |
788 axs.utils.elementIsOutsideScrollArea = function(a) { | 579 axs.utils.elementIsOutsideScrollArea = function(a) { |
789 for (var b = axs.dom.parentElement(a), c = a.ownerDocument.defaultView;b != c.
document.body;) { | 580 for (var b = axs.utils.parentElement(a), c = a.ownerDocument.defaultView;b !=
c.document.body;) { |
790 if (axs.utils.isClippedBy(a, b)) { | 581 if (axs.utils.isClippedBy(a, b)) { |
791 return !0; | 582 return!0; |
792 } | 583 } |
793 if (axs.utils.canScrollTo(a, b) && !axs.utils.elementIsOutsideScrollArea(b))
{ | 584 if (axs.utils.canScrollTo(a, b) && !axs.utils.elementIsOutsideScrollArea(b))
{ |
794 return !1; | 585 return!1; |
795 } | 586 } |
796 b = axs.dom.parentElement(b); | 587 b = axs.utils.parentElement(b); |
797 } | 588 } |
798 return !axs.utils.canScrollTo(a, c.document.body); | 589 return!axs.utils.canScrollTo(a, c.document.body); |
799 }; | 590 }; |
800 axs.utils.canScrollTo = function(a, b) { | 591 axs.utils.canScrollTo = function(a, b) { |
801 var c = a.getBoundingClientRect(), d = b.getBoundingClientRect(); | 592 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; |
802 if (b == b.ownerDocument.body) { | 593 if (c.right < f - b.scrollLeft || c.bottom < g || c.left > h || c.top > e) { |
803 var e = d.top, f = d.left | 594 return!1; |
804 } else { | |
805 e = d.top - b.scrollTop, f = d.left - b.scrollLeft; | |
806 } | 595 } |
807 var g = e + b.scrollHeight, h = f + b.scrollWidth; | 596 f = a.ownerDocument.defaultView; |
808 if (c.right < f || c.bottom < e || c.left > h || c.top > g) { | 597 g = f.getComputedStyle(b); |
809 return !1; | 598 return c.left > d.right || c.top > d.bottom ? "scroll" == g.overflow || "auto"
== g.overflow || b instanceof f.HTMLBodyElement : !0; |
810 } | |
811 e = a.ownerDocument.defaultView; | |
812 f = e.getComputedStyle(b); | |
813 return c.left > d.right || c.top > d.bottom ? "scroll" == f.overflow || "auto"
== f.overflow || b instanceof e.HTMLBodyElement : !0; | |
814 }; | 599 }; |
815 axs.utils.isClippedBy = function(a, b) { | 600 axs.utils.isClippedBy = function(a, b) { |
816 var c = a.getBoundingClientRect(), d = b.getBoundingClientRect(), e = d.top -
b.scrollTop, f = d.left - b.scrollLeft, g = a.ownerDocument.defaultView.getCompu
tedStyle(b); | 601 var c = a.getBoundingClientRect(), d = b.getBoundingClientRect(), e = d.top -
b.scrollTop, f = d.left - b.scrollLeft, g = a.ownerDocument.defaultView.getCompu
tedStyle(b); |
817 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; | 602 return(c.right < d.left || c.bottom < d.top || c.left > d.right || c.top > d.b
ottom) && "hidden" == g.overflow ? !0 : c.right < f || c.bottom < e ? "visible"
!= g.overflow : !1; |
818 }; | 603 }; |
819 axs.utils.isAncestor = function(a, b) { | 604 axs.utils.isAncestor = function(a, b) { |
820 if (null == b) { | 605 return null == b ? !1 : b === a ? !0 : axs.utils.isAncestor(a, b.parentNode); |
821 return !1; | |
822 } | |
823 if (b === a) { | |
824 return !0; | |
825 } | |
826 var c = axs.dom.composedParentNode(b); | |
827 return axs.utils.isAncestor(a, c); | |
828 }; | 606 }; |
829 axs.utils.overlappingElements = function(a) { | 607 axs.utils.overlappingElements = function(a) { |
830 if (axs.utils.elementHasZeroArea(a)) { | 608 if (axs.utils.elementHasZeroArea(a)) { |
831 return null; | 609 return null; |
832 } | 610 } |
833 for (var b = [], c = a.getClientRects(), d = 0;d < c.length;d++) { | 611 for (var b = [], c = a.getClientRects(), d = 0;d < c.length;d++) { |
834 var e = c[d], e = document.elementFromPoint((e.left + e.right) / 2, (e.top +
e.bottom) / 2); | 612 var e = c[d], e = document.elementFromPoint((e.left + e.right) / 2, (e.top +
e.bottom) / 2); |
835 if (null != e && e != a && !axs.utils.isAncestor(e, a) && !axs.utils.isAnces
tor(a, e)) { | 613 if (null != e && e != a && !axs.utils.isAncestor(e, a) && !axs.utils.isAnces
tor(a, e)) { |
836 var f = window.getComputedStyle(e, null); | 614 var f = window.getComputedStyle(e, null); |
837 f && (f = axs.utils.getBgColor(f, e)) && 0 < f.alpha && 0 > b.indexOf(e) &
& b.push(e); | 615 f && (f = axs.utils.getBgColor(f, e)) && 0 < f.alpha && 0 > b.indexOf(e) &
& b.push(e); |
(...skipping 25 matching lines...) Expand all Loading... |
863 return a && b >= c || b >= d; | 641 return a && b >= c || b >= d; |
864 } | 642 } |
865 if (c = b.match(/(\d+)em/)) { | 643 if (c = b.match(/(\d+)em/)) { |
866 return b = parseInt(c[1], 10), a && 1.2 <= b || 1.5 <= b ? !0 : !1; | 644 return b = parseInt(c[1], 10), a && 1.2 <= b || 1.5 <= b ? !0 : !1; |
867 } | 645 } |
868 if (c = b.match(/(\d+)%/)) { | 646 if (c = b.match(/(\d+)%/)) { |
869 return b = parseInt(c[1], 10), a && 120 <= b || 150 <= b ? !0 : !1; | 647 return b = parseInt(c[1], 10), a && 120 <= b || 150 <= b ? !0 : !1; |
870 } | 648 } |
871 if (c = b.match(/(\d+)pt/)) { | 649 if (c = b.match(/(\d+)pt/)) { |
872 if (b = parseInt(c[1], 10), a && 14 <= b || 18 <= b) { | 650 if (b = parseInt(c[1], 10), a && 14 <= b || 18 <= b) { |
873 return !0; | 651 return!0; |
874 } | 652 } |
875 } | 653 } |
876 return !1; | 654 return!1; |
877 }; | 655 }; |
878 axs.utils.getBgColor = function(a, b) { | 656 axs.utils.getBgColor = function(a, b) { |
879 var c = axs.color.parseColor(a.backgroundColor); | 657 var c = axs.utils.parseColor(a.backgroundColor); |
880 if (!c) { | 658 if (!c) { |
881 return null; | 659 return null; |
882 } | 660 } |
883 1 > a.opacity && (c.alpha *= a.opacity); | 661 1 > a.opacity && (c.alpha *= a.opacity); |
884 if (1 > c.alpha) { | 662 if (1 > c.alpha) { |
885 var d = axs.utils.getParentBgColor(b); | 663 var d = axs.utils.getParentBgColor(b); |
886 if (null == d) { | 664 if (null == d) { |
887 return null; | 665 return null; |
888 } | 666 } |
889 c = axs.color.flattenColors(c, d); | 667 c = axs.utils.flattenColors(c, d); |
890 } | 668 } |
891 return c; | 669 return c; |
892 }; | 670 }; |
893 axs.utils.getParentBgColor = function(a) { | 671 axs.utils.getParentBgColor = function(a) { |
894 var b = a; | 672 var b = a; |
895 a = []; | 673 a = []; |
896 for (var c = null;b = axs.dom.parentElement(b);) { | 674 for (var c = null;b = axs.utils.parentElement(b);) { |
897 var d = window.getComputedStyle(b, null); | 675 var d = window.getComputedStyle(b, null); |
898 if (d) { | 676 if (d) { |
899 var e = axs.color.parseColor(d.backgroundColor); | 677 var e = axs.utils.parseColor(d.backgroundColor); |
900 if (e && (1 > d.opacity && (e.alpha *= d.opacity), 0 != e.alpha && (a.push
(e), 1 == e.alpha))) { | 678 if (e && (1 > d.opacity && (e.alpha *= d.opacity), 0 != e.alpha && (a.push
(e), 1 == e.alpha))) { |
901 c = !0; | 679 c = !0; |
902 break; | 680 break; |
903 } | 681 } |
904 } | 682 } |
905 } | 683 } |
906 c || a.push(new axs.color.Color(255, 255, 255, 1)); | 684 c || a.push(new axs.utils.Color(255, 255, 255, 1)); |
907 for (b = a.pop();a.length;) { | 685 for (b = a.pop();a.length;) { |
908 c = a.pop(), b = axs.color.flattenColors(c, b); | 686 c = a.pop(), b = axs.utils.flattenColors(c, b); |
909 } | 687 } |
910 return b; | 688 return b; |
911 }; | 689 }; |
912 axs.utils.getFgColor = function(a, b, c) { | 690 axs.utils.getFgColor = function(a, b, c) { |
913 var d = axs.color.parseColor(a.color); | 691 var d = axs.utils.parseColor(a.color); |
914 if (!d) { | 692 if (!d) { |
915 return null; | 693 return null; |
916 } | 694 } |
917 1 > d.alpha && (d = axs.color.flattenColors(d, c)); | 695 1 > d.alpha && (d = axs.utils.flattenColors(d, c)); |
918 1 > a.opacity && (b = axs.utils.getParentBgColor(b), d.alpha *= a.opacity, d =
axs.color.flattenColors(d, b)); | 696 1 > a.opacity && (b = axs.utils.getParentBgColor(b), d.alpha *= a.opacity, d =
axs.utils.flattenColors(d, b)); |
919 return d; | 697 return d; |
920 }; | 698 }; |
| 699 axs.utils.parseColor = function(a) { |
| 700 var b = a.match(/^rgb\((\d+), (\d+), (\d+)\)$/); |
| 701 if (b) { |
| 702 a = parseInt(b[1], 10); |
| 703 var c = parseInt(b[2], 10), b = parseInt(b[3], 10), d; |
| 704 return new axs.utils.Color(a, c, b, 1); |
| 705 } |
| 706 return(b = a.match(/^rgba\((\d+), (\d+), (\d+), (\d+(\.\d+)?)\)/)) ? (d = pars
eInt(b[4], 10), a = parseInt(b[1], 10), c = parseInt(b[2], 10), b = parseInt(b[3
], 10), new axs.utils.Color(a, c, b, d)) : null; |
| 707 }; |
| 708 axs.utils.colorChannelToString = function(a) { |
| 709 a = Math.round(a); |
| 710 return 15 >= a ? "0" + a.toString(16) : a.toString(16); |
| 711 }; |
| 712 axs.utils.colorToString = function(a) { |
| 713 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() + ")"; |
| 714 }; |
| 715 axs.utils.luminanceFromContrastRatio = function(a, b, c) { |
| 716 return c ? (a + .05) * b - .05 : (a + .05) / b - .05; |
| 717 }; |
| 718 axs.utils.translateColor = function(a, b) { |
| 719 var c = a[0], c = (b - c) / ((c > b ? 0 : 1) - c); |
| 720 return axs.utils.fromYCC([b, a[1] - a[1] * c, a[2] - a[2] * c]); |
| 721 }; |
| 722 axs.utils.suggestColors = function(a, b, c, d) { |
| 723 if (!axs.utils.isLowContrast(c, d, !0)) { |
| 724 return null; |
| 725 } |
| 726 var e = {}, f = axs.utils.calculateLuminance(a), g = axs.utils.calculateLumina
nce(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), q = axs.utils.toYCC(b); |
| 727 if (axs.utils.isLowContrast(c, d, !1) && 1 >= l && 0 <= l) { |
| 728 var p = axs.utils.translateColor(q, l), l = axs.utils.calculateContrastRatio
(p, a); |
| 729 axs.utils.calculateLuminance(p); |
| 730 f = {}; |
| 731 f.fg = axs.utils.colorToString(p); |
| 732 f.bg = axs.utils.colorToString(a); |
| 733 f.contrast = l.toFixed(2); |
| 734 e.AA = f; |
| 735 } |
| 736 axs.utils.isLowContrast(c, d, !0) && 1 >= n && 0 <= n && (n = axs.utils.transl
ateColor(q, n), l = axs.utils.calculateContrastRatio(n, a), f = {}, f.fg = axs.u
tils.colorToString(n), f.bg = axs.utils.colorToString(a), f.contrast = l.toFixed
(2), e.AAA = f); |
| 737 h = axs.utils.luminanceFromContrastRatio(g, h + .02, !m); |
| 738 g = axs.utils.luminanceFromContrastRatio(g, k + .02, !m); |
| 739 a = axs.utils.toYCC(a); |
| 740 !("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.cont
rast = l.toFixed(2), e.AA = f); |
| 741 !("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.con
trast = l.toFixed(2), e.AAA = f); |
| 742 return e; |
| 743 }; |
| 744 axs.utils.flattenColors = function(a, b) { |
| 745 var c = a.alpha; |
| 746 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)); |
| 747 }; |
| 748 axs.utils.calculateLuminance = function(a) { |
| 749 return axs.utils.toYCC(a)[0]; |
| 750 }; |
| 751 axs.utils.RGBToYCCMatrix = function(a, b) { |
| 752 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)]]; |
| 753 }; |
| 754 axs.utils.invert3x3Matrix = function(a) { |
| 755 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]; |
| 756 a = a[2][2]; |
| 757 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))); |
| 758 }; |
| 759 axs.utils.scalarMultiplyMatrix = function(a, b) { |
| 760 for (var c = [[], [], []], d = 0;3 > d;d++) { |
| 761 for (var e = 0;3 > e;e++) { |
| 762 c[d][e] = a[d][e] * b; |
| 763 } |
| 764 } |
| 765 return c; |
| 766 }; |
| 767 axs.utils.kR = .2126; |
| 768 axs.utils.kB = .0722; |
| 769 axs.utils.YCC_MATRIX = axs.utils.RGBToYCCMatrix(axs.utils.kR, axs.utils.kB); |
| 770 axs.utils.INVERTED_YCC_MATRIX = axs.utils.invert3x3Matrix(axs.utils.YCC_MATRIX); |
| 771 axs.utils.convertColor = function(a, b) { |
| 772 var c = b[0], d = b[1], e = b[2]; |
| 773 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]; |
| 774 }; |
| 775 axs.utils.multiplyMatrices = function(a, b) { |
| 776 for (var c = [[], [], []], d = 0;3 > d;d++) { |
| 777 for (var e = 0;3 > e;e++) { |
| 778 c[d][e] = a[d][0] * b[0][e] + a[d][1] * b[1][e] + a[d][2] * b[2][e]; |
| 779 } |
| 780 } |
| 781 return c; |
| 782 }; |
| 783 axs.utils.toYCC = function(a) { |
| 784 var b = a.red / 255, c = a.green / 255; |
| 785 a = a.blue / 255; |
| 786 b = .03928 >= b ? b / 12.92 : Math.pow((b + .055) / 1.055, 2.4); |
| 787 c = .03928 >= c ? c / 12.92 : Math.pow((c + .055) / 1.055, 2.4); |
| 788 a = .03928 >= a ? a / 12.92 : Math.pow((a + .055) / 1.055, 2.4); |
| 789 return axs.utils.convertColor(axs.utils.YCC_MATRIX, [b, c, a]); |
| 790 }; |
| 791 axs.utils.fromYCC = function(a) { |
| 792 var b = axs.utils.convertColor(axs.utils.INVERTED_YCC_MATRIX, a), c = b[0]; |
| 793 a = b[1]; |
| 794 b = b[2]; |
| 795 c = .00303949 >= c ? 12.92 * c : 1.055 * Math.pow(c, 1 / 2.4) - .055; |
| 796 a = .00303949 >= a ? 12.92 * a : 1.055 * Math.pow(a, 1 / 2.4) - .055; |
| 797 b = .00303949 >= b ? 12.92 * b : 1.055 * Math.pow(b, 1 / 2.4) - .055; |
| 798 c = Math.min(Math.max(Math.round(255 * c), 0), 255); |
| 799 a = Math.min(Math.max(Math.round(255 * a), 0), 255); |
| 800 b = Math.min(Math.max(Math.round(255 * b), 0), 255); |
| 801 return new axs.utils.Color(c, a, b, 1); |
| 802 }; |
| 803 axs.utils.scalarMultiplyMatrix = function(a, b) { |
| 804 for (var c = [[], [], []], d = 0;3 > d;d++) { |
| 805 for (var e = 0;3 > e;e++) { |
| 806 c[d][e] = a[d][e] * b; |
| 807 } |
| 808 } |
| 809 return c; |
| 810 }; |
| 811 axs.utils.multiplyMatrices = function(a, b) { |
| 812 for (var c = [[], [], []], d = 0;3 > d;d++) { |
| 813 for (var e = 0;3 > e;e++) { |
| 814 c[d][e] = a[d][0] * b[0][e] + a[d][1] * b[1][e] + a[d][2] * b[2][e]; |
| 815 } |
| 816 } |
| 817 return c; |
| 818 }; |
921 axs.utils.getContrastRatioForElement = function(a) { | 819 axs.utils.getContrastRatioForElement = function(a) { |
922 var b = window.getComputedStyle(a, null); | 820 var b = window.getComputedStyle(a, null); |
923 return axs.utils.getContrastRatioForElementWithComputedStyle(b, a); | 821 return axs.utils.getContrastRatioForElementWithComputedStyle(b, a); |
924 }; | 822 }; |
925 axs.utils.getContrastRatioForElementWithComputedStyle = function(a, b) { | 823 axs.utils.getContrastRatioForElementWithComputedStyle = function(a, b) { |
926 if (axs.utils.isElementHidden(b)) { | 824 if (axs.utils.isElementHidden(b)) { |
927 return null; | 825 return null; |
928 } | 826 } |
929 var c = axs.utils.getBgColor(a, b); | 827 var c = axs.utils.getBgColor(a, b); |
930 if (!c) { | 828 if (!c) { |
931 return null; | 829 return null; |
932 } | 830 } |
933 var d = axs.utils.getFgColor(a, b, c); | 831 var d = axs.utils.getFgColor(a, b, c); |
934 return d ? axs.color.calculateContrastRatio(d, c) : null; | 832 return d ? axs.utils.calculateContrastRatio(d, c) : null; |
935 }; | 833 }; |
936 axs.utils.isNativeTextElement = function(a) { | 834 axs.utils.isNativeTextElement = function(a) { |
937 var b = a.tagName.toLowerCase(); | 835 var b = a.tagName.toLowerCase(); |
938 a = a.type ? a.type.toLowerCase() : ""; | 836 a = a.type ? a.type.toLowerCase() : ""; |
939 if ("textarea" == b) { | 837 if ("textarea" == b) { |
940 return !0; | 838 return!0; |
941 } | 839 } |
942 if ("input" != b) { | 840 if ("input" != b) { |
943 return !1; | 841 return!1; |
944 } | 842 } |
945 switch(a) { | 843 switch(a) { |
946 case "email": | 844 case "email": |
947 ; | 845 ; |
948 case "number": | 846 case "number": |
949 ; | 847 ; |
950 case "password": | 848 case "password": |
951 ; | 849 ; |
952 case "search": | 850 case "search": |
953 ; | 851 ; |
954 case "text": | 852 case "text": |
955 ; | 853 ; |
956 case "tel": | 854 case "tel": |
957 ; | 855 ; |
958 case "url": | 856 case "url": |
959 ; | 857 ; |
960 case "": | 858 case "": |
961 return !0; | 859 return!0; |
962 default: | 860 default: |
963 return !1; | 861 return!1; |
964 } | 862 } |
965 }; | 863 }; |
966 axs.utils.isLowContrast = function(a, b, c) { | 864 axs.utils.isLowContrast = function(a, b, c) { |
967 a = Math.round(10 * a) / 10; | 865 a = Math.round(10 * a) / 10; |
968 return c ? 4.5 > a || !axs.utils.isLargeFont(b) && 7 > a : 3 > a || !axs.utils
.isLargeFont(b) && 4.5 > a; | 866 return c ? 4.5 > a || !axs.utils.isLargeFont(b) && 7 > a : 3 > a || !axs.utils
.isLargeFont(b) && 4.5 > a; |
969 }; | 867 }; |
970 axs.utils.hasLabel = function(a) { | 868 axs.utils.hasLabel = function(a) { |
971 var b = a.tagName.toLowerCase(), c = a.type ? a.type.toLowerCase() : ""; | 869 var b = a.tagName.toLowerCase(), c = a.type ? a.type.toLowerCase() : ""; |
972 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-labelle
dby") || a.hasAttribute("id") && 0 < document.querySelectorAll('label[for="' + a
.id + '"]').length) { | 870 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-labelle
dby") || axs.utils.isNativeTextElement(a) && a.hasAttribute("placeholder") || a.
hasAttribute("id") && 0 < document.querySelectorAll('label[for="' + a.id + '"]')
.length) { |
973 return !0; | 871 return!0; |
974 } | 872 } |
975 for (b = axs.dom.parentElement(a);b;) { | 873 for (b = axs.utils.parentElement(a);b;) { |
976 if ("label" == b.tagName.toLowerCase() && b.control == a) { | 874 if ("label" == b.tagName.toLowerCase() && b.control == a) { |
977 return !0; | 875 return!0; |
978 } | 876 } |
979 b = axs.dom.parentElement(b); | 877 b = axs.utils.parentElement(b); |
980 } | 878 } |
981 return !1; | 879 return!1; |
982 }; | |
983 axs.utils.isNativelyDisableable = function(a) { | |
984 return a.tagName.toUpperCase() in axs.constants.NATIVELY_DISABLEABLE; | |
985 }; | |
986 axs.utils.isElementDisabled = function(a) { | |
987 if (axs.browserUtils.matchSelector(a, "[aria-disabled=true], [aria-disabled=tr
ue] *")) { | |
988 return !0; | |
989 } | |
990 if (!axs.utils.isNativelyDisableable(a) || axs.browserUtils.matchSelector(a, "
fieldset>legend:first-of-type *")) { | |
991 return !1; | |
992 } | |
993 for (;null !== a;a = axs.dom.parentElement(a)) { | |
994 if (axs.utils.isNativelyDisableable(a) && a.hasAttribute("disabled")) { | |
995 return !0; | |
996 } | |
997 } | |
998 return !1; | |
999 }; | 880 }; |
1000 axs.utils.isElementHidden = function(a) { | 881 axs.utils.isElementHidden = function(a) { |
1001 if (!(a instanceof a.ownerDocument.defaultView.HTMLElement)) { | 882 if (!(a instanceof a.ownerDocument.defaultView.HTMLElement)) { |
1002 return !1; | 883 return!1; |
1003 } | 884 } |
1004 if (a.hasAttribute("chromevoxignoreariahidden")) { | 885 if (a.hasAttribute("chromevoxignoreariahidden")) { |
1005 var b = !0 | 886 var b = !0 |
1006 } | 887 } |
1007 var c = window.getComputedStyle(a, null); | 888 var c = window.getComputedStyle(a, null); |
1008 return "none" == c.display || "hidden" == c.visibility ? !0 : a.hasAttribute("
aria-hidden") && "true" == a.getAttribute("aria-hidden").toLowerCase() ? !b : !1
; | 889 return "none" == c.display || "hidden" == c.visibility ? !0 : a.hasAttribute("
aria-hidden") && "true" == a.getAttribute("aria-hidden").toLowerCase() ? !b : !1
; |
1009 }; | 890 }; |
1010 axs.utils.isElementOrAncestorHidden = function(a) { | 891 axs.utils.isElementOrAncestorHidden = function(a) { |
1011 return axs.utils.isElementHidden(a) ? !0 : axs.dom.parentElement(a) ? axs.util
s.isElementOrAncestorHidden(axs.dom.parentElement(a)) : !1; | 892 return axs.utils.isElementHidden(a) ? !0 : axs.utils.parentElement(a) ? axs.ut
ils.isElementOrAncestorHidden(axs.utils.parentElement(a)) : !1; |
1012 }; | 893 }; |
1013 axs.utils.isInlineElement = function(a) { | 894 axs.utils.isInlineElement = function(a) { |
1014 a = a.tagName.toUpperCase(); | 895 a = a.tagName.toUpperCase(); |
1015 return axs.constants.InlineElements[a]; | 896 return axs.constants.InlineElements[a]; |
1016 }; | 897 }; |
1017 axs.utils.getRoles = function(a, b) { | 898 axs.utils.getRoles = function(a) { |
1018 if (!a || a.nodeType !== Node.ELEMENT_NODE || !a.hasAttribute("role") && !b) { | 899 if (!a.hasAttribute("role")) { |
1019 return null; | 900 return!1; |
1020 } | 901 } |
1021 var c = a.getAttribute("role"); | 902 a = a.getAttribute("role").split(" "); |
1022 !c && b && (c = axs.properties.getImplicitRole(a)); | 903 for (var b = [], c = !0, d = 0;d < a.length;d++) { |
1023 if (!c) { | 904 var e = a[d]; |
1024 return null; | 905 axs.constants.ARIA_ROLES[e] ? b.push({name:e, details:axs.constants.ARIA_ROL
ES[e], valid:!0}) : (b.push({name:e, valid:!1}), c = !1); |
1025 } | 906 } |
1026 for (var c = c.split(" "), d = {roles:[], valid:!1}, e = 0;e < c.length;e++) { | 907 return{roles:b, valid:c}; |
1027 var f = c[e], g = axs.constants.ARIA_ROLES[f], f = {name:f}; | |
1028 g && !g.abstract ? (f.details = g, d.applied || (d.applied = f), f.valid = d
.valid = !0) : f.valid = !1; | |
1029 d.roles.push(f); | |
1030 } | |
1031 return d; | |
1032 }; | 908 }; |
1033 axs.utils.getAriaPropertyValue = function(a, b, c) { | 909 axs.utils.getAriaPropertyValue = function(a, b, c) { |
1034 var d = a.replace(/^aria-/, ""), e = axs.constants.ARIA_PROPERTIES[d], d = {na
me:a, rawValue:b}; | 910 var d = a.replace(/^aria-/, ""), e = axs.constants.ARIA_PROPERTIES[d], d = {na
me:a, rawValue:b}; |
1035 if (!e) { | 911 if (!e) { |
1036 return d.valid = !1, d.reason = '"' + a + '" is not a valid ARIA property',
d; | 912 return d.valid = !1, d.reason = '"' + a + '" is not a valid ARIA property',
d; |
1037 } | 913 } |
1038 e = e.valueType; | 914 e = e.valueType; |
1039 if (!e) { | 915 if (!e) { |
1040 return d.valid = !1, d.reason = '"' + a + '" is not a valid ARIA property',
d; | 916 return d.valid = !1, d.reason = '"' + a + '" is not a valid ARIA property',
d; |
1041 } | 917 } |
1042 switch(e) { | 918 switch(e) { |
1043 case "idref": | 919 case "idref": |
1044 a = axs.utils.isValidIDRefValue(b, c), d.valid = a.valid, d.reason = a.rea
son, d.idref = a.idref; | 920 a = axs.utils.isValidIDRefValue(b, c), d.valid = a.valid, d.reason = a.rea
son, d.idref = a.idref; |
1045 case "idref_list": | 921 case "idref_list": |
1046 a = b.split(/\s+/); | 922 a = b.split(/\s+/); |
1047 d.valid = !0; | 923 d.valid = !0; |
1048 for (b = 0;b < a.length;b++) { | 924 for (b = 0;b < a.length;b++) { |
1049 e = axs.utils.isValidIDRefValue(a[b], c), e.valid || (d.valid = !1), d.v
alues ? d.values.push(e) : d.values = [e]; | 925 e = axs.utils.isValidIDRefValue(a[b], c), e.valid || (d.valid = !1), d.v
alues ? d.values.push(e) : d.values = [e]; |
1050 } | 926 } |
1051 return d; | 927 return d; |
1052 case "integer": | 928 case "integer": |
| 929 ; |
| 930 case "decimal": |
1053 c = axs.utils.isValidNumber(b); | 931 c = axs.utils.isValidNumber(b); |
1054 if (!c.valid) { | 932 if (!c.valid) { |
1055 return d.valid = !1, d.reason = c.reason, d; | 933 return d.valid = !1, d.reason = c.reason, d; |
1056 } | 934 } |
1057 Math.floor(c.value) !== c.value ? (d.valid = !1, d.reason = "" + b + " is
not a whole integer") : (d.valid = !0, d.value = c.value); | 935 Math.floor(c.value) != c.value ? (d.valid = !1, d.reason = "" + b + " is n
ot a whole integer") : (d.valid = !0, d.value = c.value); |
1058 return d; | 936 return d; |
1059 case "decimal": | |
1060 ; | |
1061 case "number": | 937 case "number": |
1062 c = axs.utils.isValidNumber(b); | 938 c = axs.utils.isValidNumber(b), c.valid && (d.valid = !0, d.value = c.valu
e); |
1063 d.valid = c.valid; | |
1064 if (!c.valid) { | |
1065 return d.reason = c.reason, d; | |
1066 } | |
1067 d.value = c.value; | |
1068 return d; | |
1069 case "string": | 939 case "string": |
1070 return d.valid = !0, d.value = b, d; | 940 return d.valid = !0, d.value = b, d; |
1071 case "token": | 941 case "token": |
1072 return c = axs.utils.isValidTokenValue(a, b.toLowerCase()), c.valid ? (d.v
alid = !0, d.value = c.value) : (d.valid = !1, d.value = b, d.reason = c.reason)
, d; | 942 return c = axs.utils.isValidTokenValue(a, b.toLowerCase()), c.valid ? (d.v
alid = !0, d.value = c.value) : (d.valid = !1, d.value = b, d.reason = c.reason)
, d; |
1073 case "token_list": | 943 case "token_list": |
1074 e = b.split(/\s+/); | 944 e = b.split(/\s+/); |
1075 d.valid = !0; | 945 d.valid = !0; |
1076 for (b = 0;b < e.length;b++) { | 946 for (b = 0;b < e.length;b++) { |
1077 c = axs.utils.isValidTokenValue(a, e[b].toLowerCase()), c.valid || (d.va
lid = !1, d.reason ? (d.reason = [d.reason], d.reason.push(c.reason)) : (d.reaso
n = c.reason, d.possibleValues = c.possibleValues)), d.values ? d.values.push(c.
value) : d.values = [c.value]; | 947 c = axs.utils.isValidTokenValue(a, e[b].toLowerCase()), c.valid || (d.va
lid = !1, d.reason ? (d.reason = [d.reason], d.reason.push(c.reason)) : (d.reaso
n = c.reason, d.possibleValues = c.possibleValues)), d.values ? d.values.push(c.
value) : d.values = [c.value]; |
1078 } | 948 } |
(...skipping 19 matching lines...) Expand all Loading... |
1098 var b = JSON.parse(a); | 968 var b = JSON.parse(a); |
1099 } catch (c) { | 969 } catch (c) { |
1100 b = ""; | 970 b = ""; |
1101 } | 971 } |
1102 return "boolean" != typeof b ? {valid:!1, value:a, reason:'"' + a + '" is not
a true/false value'} : {valid:!0, value:b}; | 972 return "boolean" != typeof b ? {valid:!1, value:a, reason:'"' + a + '" is not
a true/false value'} : {valid:!0, value:b}; |
1103 }; | 973 }; |
1104 axs.utils.isValidIDRefValue = function(a, b) { | 974 axs.utils.isValidIDRefValue = function(a, b) { |
1105 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 +
'"'}; | 975 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 +
'"'}; |
1106 }; | 976 }; |
1107 axs.utils.isValidNumber = function(a) { | 977 axs.utils.isValidNumber = function(a) { |
1108 var b = {valid:!1, value:a, reason:'"' + a + '" is not a number'}; | 978 try { |
1109 if (!a) { | 979 var b = JSON.parse(a); |
1110 return b; | 980 } catch (c) { |
| 981 return{valid:!1, value:a, reason:'"' + a + '" is not a number'}; |
1111 } | 982 } |
1112 if (/^0x/i.test(a)) { | 983 return "number" != typeof b ? {valid:!1, value:a, reason:'"' + a + '" is not a
number'} : {valid:!0, value:b}; |
1113 return b.reason = '"' + a + '" is not a decimal number', b; | |
1114 } | |
1115 a *= 1; | |
1116 return isFinite(a) ? {valid:!0, value:a} : b; | |
1117 }; | 984 }; |
1118 axs.utils.isElementImplicitlyFocusable = function(a) { | 985 axs.utils.isElementImplicitlyFocusable = function(a) { |
1119 var b = a.ownerDocument.defaultView; | 986 var b = a.ownerDocument.defaultView; |
1120 return a instanceof b.HTMLAnchorElement || a instanceof b.HTMLAreaElement ? a.
hasAttribute("href") : a instanceof b.HTMLInputElement || a instanceof b.HTMLSel
ectElement || a instanceof b.HTMLTextAreaElement || a instanceof b.HTMLButtonEle
ment || a instanceof b.HTMLIFrameElement ? !a.disabled : !1; | 987 return a instanceof b.HTMLAnchorElement || a instanceof b.HTMLAreaElement ? a.
hasAttribute("href") : a instanceof b.HTMLInputElement || a instanceof b.HTMLSel
ectElement || a instanceof b.HTMLTextAreaElement || a instanceof b.HTMLButtonEle
ment || a instanceof b.HTMLIFrameElement ? !a.disabled : !1; |
1121 }; | 988 }; |
1122 axs.utils.values = function(a) { | 989 axs.utils.values = function(a) { |
1123 var b = [], c; | 990 var b = [], c; |
1124 for (c in a) { | 991 for (c in a) { |
1125 a.hasOwnProperty(c) && "function" != typeof a[c] && b.push(a[c]); | 992 a.hasOwnProperty(c) && "function" != typeof a[c] && b.push(a[c]); |
1126 } | 993 } |
(...skipping 26 matching lines...) Expand all Loading... |
1153 for (c = 0;c < a.parentNode.children.length;c++) { | 1020 for (c = 0;c < a.parentNode.children.length;c++) { |
1154 var e = a.parentNode.children[c]; | 1021 var e = a.parentNode.children[c]; |
1155 axs.browserUtils.matchSelector(e, b) && d++; | 1022 axs.browserUtils.matchSelector(e, b) && d++; |
1156 if (e === a) { | 1023 if (e === a) { |
1157 break; | 1024 break; |
1158 } | 1025 } |
1159 } | 1026 } |
1160 } else { | 1027 } else { |
1161 d = 1; | 1028 d = 1; |
1162 } | 1029 } |
1163 if (1 == d) { | 1030 return 1 == d ? axs.utils.getQuerySelectorText(a.parentNode) + " > " + b :
axs.utils.getQuerySelectorText(a.parentNode) + " > " + b + ":nth-of-type(" + d
+ ")"; |
1164 return axs.utils.getQuerySelectorText(a.parentNode) + " > " + b; | |
1165 } | |
1166 } | 1031 } |
1167 if (a.parentNode) { | 1032 if (a.parentNode) { |
1168 b = a.parentNode.children; | 1033 b = a.parentNode.children; |
1169 d = 1; | 1034 d = 1; |
1170 for (c = 0;b[c] !== a;) { | 1035 for (c = 0;b[c] !== a;) { |
1171 b[c].tagName == a.tagName && d++, c++; | 1036 b[c].tagName == a.tagName && d++, c++; |
1172 } | 1037 } |
1173 c = ""; | 1038 c = ""; |
1174 "BODY" != a.parentNode.tagName && (c = axs.utils.getQuerySelectorText(a.pa
rentNode) + " > "); | 1039 "BODY" != a.parentNode.tagName && (c = axs.utils.getQuerySelectorText(a.pa
rentNode) + " > "); |
1175 return 1 == d ? c + a.tagName : c + a.tagName + ":nth-of-type(" + d + ")"; | 1040 return 1 == d ? c + a.tagName : c + a.tagName + ":nth-of-type(" + d + ")"; |
1176 } | 1041 } |
1177 } else { | 1042 } else { |
1178 if (a.selectorText) { | 1043 if (a.selectorText) { |
1179 return a.selectorText; | 1044 return a.selectorText; |
1180 } | 1045 } |
1181 } | 1046 } |
1182 return ""; | 1047 return ""; |
1183 }; | 1048 }; |
1184 axs.utils.getAriaIdReferrers = function(a, b) { | |
1185 var c = function(a) { | |
1186 var b = axs.constants.ARIA_PROPERTIES[a]; | |
1187 if (b) { | |
1188 if ("idref" === b.valueType) { | |
1189 return "[aria-" + a + "='" + d + "']"; | |
1190 } | |
1191 if ("idref_list" === b.valueType) { | |
1192 return "[aria-" + a + "~='" + d + "']"; | |
1193 } | |
1194 } | |
1195 return ""; | |
1196 }; | |
1197 if (!a) { | |
1198 return null; | |
1199 } | |
1200 var d = a.id; | |
1201 if (!d) { | |
1202 return null; | |
1203 } | |
1204 d = d.replace(/'/g, "\\'"); | |
1205 if (b) { | |
1206 var e = b.replace(/^aria-/, ""), f = c(e); | |
1207 if (f) { | |
1208 return a.ownerDocument.querySelectorAll(f); | |
1209 } | |
1210 } else { | |
1211 var g = []; | |
1212 for (e in axs.constants.ARIA_PROPERTIES) { | |
1213 (f = c(e)) && g.push(f); | |
1214 } | |
1215 return a.ownerDocument.querySelectorAll(g.join(",")); | |
1216 } | |
1217 return null; | |
1218 }; | |
1219 axs.utils.getHtmlIdReferrers = function(a) { | |
1220 if (!a) { | |
1221 return null; | |
1222 } | |
1223 var b = a.id; | |
1224 if (!b) { | |
1225 return null; | |
1226 } | |
1227 var b = b.replace(/'/g, "\\'"), c = "[contextmenu='{id}'] [itemref~='{id}'] bu
tton[form='{id}'] button[menu='{id}'] fieldset[form='{id}'] input[form='{id}'] i
nput[list='{id}'] keygen[form='{id}'] label[for='{id}'] label[form='{id}'] menui
tem[command='{id}'] object[form='{id}'] output[for~='{id}'] output[form='{id}']
select[form='{id}'] td[headers~='{id}'] textarea[form='{id}'] tr[headers~='{id}'
]".split(" ").map(function(a) { | |
1228 return a.replace("{id}", b); | |
1229 }); | |
1230 return a.ownerDocument.querySelectorAll(c.join(",")); | |
1231 }; | |
1232 axs.utils.getIdReferrers = function(a) { | |
1233 var b = [], c = axs.utils.getHtmlIdReferrers(a); | |
1234 c && (b = b.concat(Array.prototype.slice.call(c))); | |
1235 (c = axs.utils.getAriaIdReferrers(a)) && (b = b.concat(Array.prototype.slice.c
all(c))); | |
1236 return b; | |
1237 }; | |
1238 axs.utils.getIdReferents = function(a, b) { | |
1239 var c = [], d = a.replace(/^aria-/, ""), d = axs.constants.ARIA_PROPERTIES[d]; | |
1240 if (!d || !b.hasAttribute(a)) { | |
1241 return c; | |
1242 } | |
1243 d = d.valueType; | |
1244 if ("idref_list" === d || "idref" === d) { | |
1245 for (var d = b.ownerDocument, e = b.getAttribute(a), e = e.split(/\s+/), f =
0, g = e.length;f < g;f++) { | |
1246 var h = d.getElementById(e[f]); | |
1247 h && (c[c.length] = h); | |
1248 } | |
1249 } | |
1250 return c; | |
1251 }; | |
1252 axs.utils.getAriaPropertiesByValueType = function(a) { | |
1253 var b = {}, c; | |
1254 for (c in axs.constants.ARIA_PROPERTIES) { | |
1255 var d = axs.constants.ARIA_PROPERTIES[c]; | |
1256 d && 0 <= a.indexOf(d.valueType) && (b[c] = d); | |
1257 } | |
1258 return b; | |
1259 }; | |
1260 axs.utils.getSelectorForAriaProperties = function(a) { | |
1261 a = Object.keys(a).map(function(a) { | |
1262 return "[aria-" + a + "]"; | |
1263 }); | |
1264 a.sort(); | |
1265 return a.join(","); | |
1266 }; | |
1267 axs.utils.findDescendantsWithRole = function(a, b) { | |
1268 if (!a || !b) { | |
1269 return []; | |
1270 } | |
1271 var c = axs.properties.getSelectorForRole(b); | |
1272 if (c && (c = a.querySelectorAll(c))) { | |
1273 c = Array.prototype.map.call(c, function(a) { | |
1274 return a; | |
1275 }); | |
1276 } else { | |
1277 return []; | |
1278 } | |
1279 return c; | |
1280 }; | |
1281 axs.properties = {}; | 1049 axs.properties = {}; |
1282 axs.properties.TEXT_CONTENT_XPATH = './/text()[normalize-space(.)!=""]/parent::*
[name()!="script"]'; | 1050 axs.properties.TEXT_CONTENT_XPATH = './/text()[normalize-space(.)!=""]/parent::*
[name()!="script"]'; |
1283 axs.properties.getFocusProperties = function(a) { | 1051 axs.properties.getFocusProperties = function(a) { |
1284 var b = {}, c = a.getAttribute("tabindex"); | 1052 var b = {}, c = a.getAttribute("tabindex"); |
1285 void 0 != c ? b.tabindex = {value:c, valid:!0} : axs.utils.isElementImplicitly
Focusable(a) && (b.implicitlyFocusable = {value:!0, valid:!0}); | 1053 void 0 != c ? b.tabindex = {value:c, valid:!0} : axs.utils.isElementImplicitly
Focusable(a) && (b.implicitlyFocusable = {value:!0, valid:!0}); |
1286 if (0 == Object.keys(b).length) { | 1054 if (0 == Object.keys(b).length) { |
1287 return null; | 1055 return null; |
1288 } | 1056 } |
1289 var d = axs.utils.elementIsTransparent(a), e = axs.utils.elementHasZeroArea(a)
, f = axs.utils.elementIsOutsideScrollArea(a), g = axs.utils.overlappingElements
(a); | 1057 var d = axs.utils.elementIsTransparent(a), e = axs.utils.elementHasZeroArea(a)
, f = axs.utils.elementIsOutsideScrollArea(a), g = axs.utils.overlappingElements
(a); |
1290 if (d || e || f || 0 < g.length) { | 1058 if (d || e || f || 0 < g.length) { |
(...skipping 12 matching lines...) Expand all Loading... |
1303 return b; | 1071 return b; |
1304 }; | 1072 }; |
1305 axs.properties.getHiddenReason = function(a) { | 1073 axs.properties.getHiddenReason = function(a) { |
1306 if (!(a && a instanceof a.ownerDocument.defaultView.HTMLElement)) { | 1074 if (!(a && a instanceof a.ownerDocument.defaultView.HTMLElement)) { |
1307 return null; | 1075 return null; |
1308 } | 1076 } |
1309 if (a.hasAttribute("chromevoxignoreariahidden")) { | 1077 if (a.hasAttribute("chromevoxignoreariahidden")) { |
1310 var b = !0 | 1078 var b = !0 |
1311 } | 1079 } |
1312 var c = window.getComputedStyle(a, null); | 1080 var c = window.getComputedStyle(a, null); |
1313 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:"a
ria-hidden", on:a} : axs.properties.getHiddenReason(axs.dom.parentElement(a)); | 1081 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:"a
ria-hidden", on:a} : axs.properties.getHiddenReason(axs.utils.parentElement(a)); |
1314 }; | 1082 }; |
1315 axs.properties.getColorProperties = function(a) { | 1083 axs.properties.getColorProperties = function(a) { |
1316 var b = {}; | 1084 var b = {}; |
1317 (a = axs.properties.getContrastRatioProperties(a)) && (b.contrastRatio = a); | 1085 (a = axs.properties.getContrastRatioProperties(a)) && (b.contrastRatio = a); |
1318 return 0 == Object.keys(b).length ? null : b; | 1086 return 0 == Object.keys(b).length ? null : b; |
1319 }; | 1087 }; |
1320 axs.properties.hasDirectTextDescendant = function(a) { | 1088 axs.properties.hasDirectTextDescendant = function(a) { |
1321 function b() { | 1089 for (var b = (a.nodeType == Node.DOCUMENT_NODE ? a : a.ownerDocument).evaluate
(axs.properties.TEXT_CONTENT_XPATH, a, null, XPathResult.ANY_TYPE, null), c = !1
, d = b.iterateNext();null != d;d = b.iterateNext()) { |
1322 for (var b = c.evaluate(axs.properties.TEXT_CONTENT_XPATH, a, null, XPathRes
ult.ANY_TYPE, null), e = b.iterateNext();null != e;e = b.iterateNext()) { | 1090 if (d === a) { |
1323 if (e === a) { | 1091 c = !0; |
1324 return !0; | 1092 break; |
1325 } | |
1326 } | 1093 } |
1327 return !1; | |
1328 } | 1094 } |
1329 var c; | 1095 return c; |
1330 c = a.nodeType == Node.DOCUMENT_NODE ? a : a.ownerDocument; | |
1331 return c.evaluate ? b() : function() { | |
1332 for (var b = c.createTreeWalker(a, NodeFilter.SHOW_TEXT, null, !1);b.nextNod
e();) { | |
1333 var e = b.currentNode, f = e.parentNode.tagName.toLowerCase(); | |
1334 if (e.nodeValue.trim() && "script" !== f && a !== e) { | |
1335 return !0; | |
1336 } | |
1337 } | |
1338 return !1; | |
1339 }(); | |
1340 }; | 1096 }; |
1341 axs.properties.getContrastRatioProperties = function(a) { | 1097 axs.properties.getContrastRatioProperties = function(a) { |
1342 if (!axs.properties.hasDirectTextDescendant(a)) { | 1098 if (!axs.properties.hasDirectTextDescendant(a)) { |
1343 return null; | 1099 return null; |
1344 } | 1100 } |
1345 var b = {}, c = window.getComputedStyle(a, null), d = axs.utils.getBgColor(c,
a); | 1101 var b = {}, c = window.getComputedStyle(a, null), d = axs.utils.getBgColor(c,
a); |
1346 if (!d) { | 1102 if (!d) { |
1347 return null; | 1103 return null; |
1348 } | 1104 } |
1349 b.backgroundColor = axs.color.colorToString(d); | 1105 b.backgroundColor = axs.utils.colorToString(d); |
1350 var e = axs.utils.getFgColor(c, a, d); | 1106 var e = axs.utils.getFgColor(c, a, d); |
1351 b.foregroundColor = axs.color.colorToString(e); | 1107 b.foregroundColor = axs.utils.colorToString(e); |
1352 a = axs.utils.getContrastRatioForElementWithComputedStyle(c, a); | 1108 a = axs.utils.getContrastRatioForElementWithComputedStyle(c, a); |
1353 if (!a) { | 1109 if (!a) { |
1354 return null; | 1110 return null; |
1355 } | 1111 } |
1356 b.value = a.toFixed(2); | 1112 b.value = a.toFixed(2); |
1357 axs.utils.isLowContrast(a, c) && (b.alert = !0); | 1113 axs.utils.isLowContrast(a, c) && (b.alert = !0); |
1358 var f = axs.utils.isLargeFont(c) ? 3 : 4.5, c = axs.utils.isLargeFont(c) ? 4.5
: 7, g = {}; | 1114 (c = axs.utils.suggestColors(d, e, a, c)) && Object.keys(c).length && (b.sugge
stedColors = c); |
1359 f > a && (g.AA = f); | |
1360 c > a && (g.AAA = c); | |
1361 if (!Object.keys(g).length) { | |
1362 return b; | |
1363 } | |
1364 (d = axs.color.suggestColors(d, e, g)) && Object.keys(d).length && (b.suggeste
dColors = d); | |
1365 return b; | 1115 return b; |
1366 }; | 1116 }; |
1367 axs.properties.findTextAlternatives = function(a, b, c, d) { | 1117 axs.properties.findTextAlternatives = function(a, b, c, d) { |
1368 var e = c || !1; | 1118 var e = c || !1; |
1369 c = axs.dom.asElement(a); | 1119 c = axs.utils.asElement(a); |
1370 if (!c || !d && axs.utils.isElementOrAncestorHidden(c)) { | 1120 if (!c || !e && !d && axs.utils.isElementOrAncestorHidden(c)) { |
1371 return null; | 1121 return null; |
1372 } | 1122 } |
1373 if (a.nodeType == Node.TEXT_NODE) { | 1123 if (a.nodeType == Node.TEXT_NODE) { |
1374 return c = {type:"text"}, c.text = a.textContent, c.lastWord = axs.propertie
s.getLastWord(c.text), b.content = c, a.textContent; | 1124 return c = {type:"text"}, c.text = a.textContent, c.lastWord = axs.propertie
s.getLastWord(c.text), b.content = c, a.textContent; |
1375 } | 1125 } |
1376 a = null; | 1126 a = null; |
1377 e || (a = axs.properties.getTextFromAriaLabelledby(c, b)); | 1127 e || (a = axs.properties.getTextFromAriaLabelledby(c, b)); |
1378 if (c.hasAttribute("aria-label")) { | 1128 c.hasAttribute("aria-label") && (d = {type:"text"}, d.text = c.getAttribute("a
ria-label"), d.lastWord = axs.properties.getLastWord(d.text), a ? d.unused = !0
: e && axs.utils.elementIsHtmlControl(c) || (a = d.text), b.ariaLabel = d); |
1379 var f = {type:"text"}; | |
1380 f.text = c.getAttribute("aria-label"); | |
1381 f.lastWord = axs.properties.getLastWord(f.text); | |
1382 a ? f.unused = !0 : e && axs.utils.elementIsHtmlControl(c) || (a = f.text); | |
1383 b.ariaLabel = f; | |
1384 } | |
1385 c.hasAttribute("role") && "presentation" == c.getAttribute("role") || (a = axs
.properties.getTextFromHostLanguageAttributes(c, b, a, e)); | 1129 c.hasAttribute("role") && "presentation" == c.getAttribute("role") || (a = axs
.properties.getTextFromHostLanguageAttributes(c, b, a, e)); |
1386 if (e && axs.utils.elementIsHtmlControl(c)) { | 1130 if (e && axs.utils.elementIsHtmlControl(c)) { |
1387 f = c.ownerDocument.defaultView; | 1131 d = c.ownerDocument.defaultView; |
1388 if (c instanceof f.HTMLInputElement) { | 1132 if (c instanceof d.HTMLInputElement) { |
1389 var g = c; | 1133 var f = c; |
1390 "text" == g.type && g.value && 0 < g.value.length && (b.controlValue = {te
xt:g.value}); | 1134 "text" == f.type && f.value && 0 < f.value.length && (b.controlValue = {te
xt:f.value}); |
1391 "range" == g.type && (b.controlValue = {text:g.value}); | 1135 "range" == f.type && (b.controlValue = {text:f.value}); |
1392 } | 1136 } |
1393 c instanceof f.HTMLSelectElement && (b.controlValue = {text:c.value}); | 1137 c instanceof d.HTMLSelectElement && (b.controlValue = {text:c.value}); |
1394 b.controlValue && (f = b.controlValue, a ? f.unused = !0 : a = f.text); | 1138 b.controlValue && (d = b.controlValue, a ? d.unused = !0 : a = d.text); |
1395 } | 1139 } |
1396 if (e && axs.utils.elementIsAriaWidget(c)) { | 1140 if (e && axs.utils.elementIsAriaWidget(c)) { |
1397 e = c.getAttribute("role"); | 1141 e = c.getAttribute("role"); |
1398 "textbox" == e && c.textContent && 0 < c.textContent.length && (b.controlVal
ue = {text:c.textContent}); | 1142 "textbox" == e && c.textContent && 0 < c.textContent.length && (b.controlVal
ue = {text:c.textContent}); |
1399 if ("slider" == e || "spinbutton" == e) { | 1143 if ("slider" == e || "spinbutton" == e) { |
1400 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")}); | 1144 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")}); |
1401 } | 1145 } |
1402 if ("menu" == e) { | 1146 if ("menu" == e) { |
1403 for (var h = c.querySelectorAll("[role=menuitemcheckbox], [role=menuitemra
dio]"), f = [], g = 0;g < h.length;g++) { | 1147 var g = c.querySelectorAll("[role=menuitemcheckbox], [role=menuitemradio]"
); |
1404 "true" == h[g].getAttribute("aria-checked") && f.push(h[g]); | 1148 d = []; |
| 1149 for (f = 0;f < g.length;f++) { |
| 1150 "true" == g[f].getAttribute("aria-checked") && d.push(g[f]); |
1405 } | 1151 } |
1406 if (0 < f.length) { | 1152 if (0 < d.length) { |
1407 h = ""; | 1153 g = ""; |
1408 for (g = 0;g < f.length;g++) { | 1154 for (f = 0;f < d.length;f++) { |
1409 h += axs.properties.findTextAlternatives(f[g], {}, !0), g < f.length -
1 && (h += ", "); | 1155 g += axs.properties.findTextAlternatives(d[f], {}, !0), f < d.length -
1 && (g += ", "); |
1410 } | 1156 } |
1411 b.controlValue = {text:h}; | 1157 b.controlValue = {text:g}; |
1412 } | 1158 } |
1413 } | 1159 } |
1414 if ("combobox" == e || "select" == e) { | 1160 if ("combobox" == e || "select" == e) { |
1415 b.controlValue = {text:"TODO"}; | 1161 b.controlValue = {text:"TODO"}; |
1416 } | 1162 } |
1417 b.controlValue && (f = b.controlValue, a ? f.unused = !0 : a = f.text); | 1163 b.controlValue && (d = b.controlValue, a ? d.unused = !0 : a = d.text); |
1418 } | 1164 } |
1419 f = !0; | 1165 d = !0; |
1420 c.hasAttribute("role") && (e = c.getAttribute("role"), (e = axs.constants.ARIA
_ROLES[e]) && (!e.namefrom || 0 > e.namefrom.indexOf("contents")) && (f = !1)); | 1166 c.hasAttribute("role") && (e = c.getAttribute("role"), (e = axs.constants.ARIA
_ROLES[e]) && (!e.namefrom || 0 > e.namefrom.indexOf("contents")) && (d = !1)); |
1421 (d = axs.properties.getTextFromDescendantContent(c, d)) && f && (e = {type:"te
xt"}, e.text = d, e.lastWord = axs.properties.getLastWord(e.text), a ? e.unused
= !0 : a = d, b.content = e); | 1167 (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); |
1422 c.hasAttribute("title") && (d = {type:"string", valid:!0}, d.text = c.getAttri
bute("title"), d.lastWord = axs.properties.getLastWord(d.lastWord), a ? d.unused
= !0 : a = d.text, b.title = d); | 1168 c.hasAttribute("title") && (e = {type:"string", valid:!0}, e.text = c.getAttri
bute("title"), e.lastWord = axs.properties.getLastWord(e.lastWord), a ? e.unused
= !0 : a = e.text, b.title = e); |
1423 return 0 == Object.keys(b).length && null == a ? null : a; | 1169 return 0 == Object.keys(b).length && null == a ? null : a; |
1424 }; | 1170 }; |
1425 axs.properties.getTextFromDescendantContent = function(a, b) { | 1171 axs.properties.getTextFromDescendantContent = function(a) { |
1426 for (var c = a.childNodes, d = [], e = 0;e < c.length;e++) { | 1172 var b = a.childNodes; |
1427 var f = axs.properties.findTextAlternatives(c[e], {}, !0, b); | 1173 a = []; |
1428 f && d.push(f.trim()); | 1174 for (var c = 0;c < b.length;c++) { |
| 1175 var d = axs.properties.findTextAlternatives(b[c], {}, !0); |
| 1176 d && a.push(d.trim()); |
1429 } | 1177 } |
1430 if (d.length) { | 1178 if (a.length) { |
1431 c = ""; | 1179 b = ""; |
1432 for (e = 0;e < d.length;e++) { | 1180 for (c = 0;c < a.length;c++) { |
1433 c = [c, d[e]].join(" ").trim(); | 1181 b = [b, a[c]].join(" ").trim(); |
1434 } | 1182 } |
1435 return c; | 1183 return b; |
1436 } | 1184 } |
1437 return null; | 1185 return null; |
1438 }; | 1186 }; |
1439 axs.properties.getTextFromAriaLabelledby = function(a, b) { | 1187 axs.properties.getTextFromAriaLabelledby = function(a, b) { |
1440 var c = null; | 1188 var c = null; |
1441 if (!a.hasAttribute("aria-labelledby")) { | 1189 if (!a.hasAttribute("aria-labelledby")) { |
1442 return c; | 1190 return c; |
1443 } | 1191 } |
1444 for (var d = a.getAttribute("aria-labelledby").split(/\s+/), e = {valid:!0}, f
= [], g = [], h = 0;h < d.length;h++) { | 1192 for (var d = a.getAttribute("aria-labelledby").split(/\s+/), e = {valid:!0}, f
= [], g = [], h = 0;h < d.length;h++) { |
1445 var k = {type:"element"}, m = d[h]; | 1193 var k = {type:"element"}, m = d[h]; |
1446 k.value = m; | 1194 k.value = m; |
1447 var l = document.getElementById(m); | 1195 var l = document.getElementById(m); |
1448 l ? (k.valid = !0, k.text = axs.properties.findTextAlternatives(l, {}, !0, !
0), k.lastWord = axs.properties.getLastWord(k.text), f.push(k.text), k.element =
l) : (k.valid = !1, e.valid = !1, k.errorMessage = {messageKey:"noElementWithId
", args:[m]}); | 1196 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:"noEle
mentWithId", args:[m]}); |
1449 g.push(k); | 1197 g.push(k); |
1450 } | 1198 } |
1451 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); | 1199 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); |
1452 return c; | 1200 return c; |
1453 }; | 1201 }; |
1454 axs.properties.getTextFromHostLanguageAttributes = function(a, b, c, d) { | 1202 axs.properties.getTextFromHostLanguageAttributes = function(a, b, c, d) { |
1455 if (axs.browserUtils.matchSelector(a, "img") && a.hasAttribute("alt")) { | 1203 if (axs.browserUtils.matchSelector(a, "img")) { |
1456 var e = {type:"string", valid:!0}; | 1204 if (a.hasAttribute("alt")) { |
1457 e.text = a.getAttribute("alt"); | 1205 var e = {type:"string", valid:!0}; |
1458 c ? e.unused = !0 : c = e.text; | 1206 e.text = a.getAttribute("alt"); |
1459 b.alt = e; | 1207 c ? e.unused = !0 : c = e.text; |
| 1208 b.alt = e; |
| 1209 } else { |
| 1210 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}); |
| 1211 } |
1460 } | 1212 } |
1461 if (axs.browserUtils.matchSelector(a, 'input:not([type="hidden"]):not([disable
d]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), v
ideo:not([disabled])') && !d) { | 1213 if (axs.browserUtils.matchSelector(a, 'input:not([type="hidden"]):not([disable
d]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), v
ideo:not([disabled])') && !d) { |
1462 if (a.hasAttribute("id")) { | 1214 if (a.hasAttribute("id")) { |
1463 d = document.querySelectorAll('label[for="' + a.id + '"]'); | 1215 d = document.querySelectorAll('label[for="' + a.id + '"]'); |
1464 for (var e = {}, f = [], g = [], h = 0;h < d.length;h++) { | 1216 for (var e = {}, f = [], g = [], h = 0;h < d.length;h++) { |
1465 var k = {type:"element"}, m = d[h], l = axs.properties.findTextAlternati
ves(m, {}, !0); | 1217 var k = {type:"element"}, m = d[h], l = axs.properties.findTextAlternati
ves(m, {}, !0); |
1466 l && 0 < l.trim().length && (k.text = l.trim(), g.push(l.trim())); | 1218 l && 0 < l.trim().length && (k.text = l.trim(), g.push(l.trim())); |
1467 k.element = m; | 1219 k.element = m; |
1468 f.push(k); | 1220 f.push(k); |
1469 } | 1221 } |
1470 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); | 1222 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); |
1471 } | 1223 } |
1472 d = axs.dom.parentElement(a); | 1224 d = axs.utils.parentElement(a); |
1473 for (e = {};d;) { | 1225 for (e = {};d;) { |
1474 if ("label" == d.tagName.toLowerCase() && (f = d, f.control == a)) { | 1226 if ("label" == d.tagName.toLowerCase() && (f = d, f.control == a)) { |
1475 e.type = "element"; | 1227 e.type = "element"; |
1476 e.text = axs.properties.findTextAlternatives(f, {}, !0); | 1228 e.text = axs.properties.findTextAlternatives(f, {}, !0); |
1477 e.lastWord = axs.properties.getLastWord(e.text); | 1229 e.lastWord = axs.properties.getLastWord(e.text); |
1478 e.element = f; | 1230 e.element = f; |
1479 break; | 1231 break; |
1480 } | 1232 } |
1481 d = axs.dom.parentElement(d); | 1233 d = axs.utils.parentElement(d); |
1482 } | 1234 } |
1483 e.text && (c ? e.unused = !0 : c = e.text, b.labelWrapped = e); | 1235 e.text && (c ? e.unused = !0 : c = e.text, b.labelWrapped = e); |
1484 axs.browserUtils.matchSelector(a, 'input[type="image"]') && a.hasAttribute("
alt") && (e = {type:"string", valid:!0}, e.text = a.getAttribute("alt"), c ? e.u
nused = !0 : c = e.text, b.alt = e); | |
1485 Object.keys(b).length || (b.noLabel = !0); | 1236 Object.keys(b).length || (b.noLabel = !0); |
1486 } | 1237 } |
1487 return c; | 1238 return c; |
1488 }; | 1239 }; |
1489 axs.properties.getLastWord = function(a) { | 1240 axs.properties.getLastWord = function(a) { |
1490 if (!a) { | 1241 if (!a) { |
1491 return null; | 1242 return null; |
1492 } | 1243 } |
1493 var b = a.lastIndexOf(" ") + 1, c = a.length - 10; | 1244 var b = a.lastIndexOf(" ") + 1, c = a.length - 10; |
1494 return a.substring(b > c ? b : c); | 1245 return a.substring(b > c ? b : c); |
1495 }; | 1246 }; |
1496 axs.properties.getTextProperties = function(a) { | 1247 axs.properties.getTextProperties = function(a) { |
1497 var b = {}, c = axs.properties.findTextAlternatives(a, b, !1, !0); | 1248 var b = {}; |
1498 if (0 == Object.keys(b).length && ((a = axs.dom.asElement(a)) && axs.browserUt
ils.matchSelector(a, "img") && (b.alt = {valid:!1, errorMessage:"No alt value pr
ovided"}, a = a.src, "string" == typeof a && (c = a.split("/").pop(), b.filename
= {text:c})), !c)) { | 1249 a = axs.properties.findTextAlternatives(a, b, !1, !0); |
1499 return null; | 1250 if (0 == Object.keys(b).length) { |
| 1251 if (!a) { |
| 1252 return null; |
| 1253 } |
| 1254 b.hasProperties = !1; |
| 1255 } else { |
| 1256 b.hasProperties = !0; |
1500 } | 1257 } |
1501 b.hasProperties = Boolean(Object.keys(b).length); | 1258 b.computedText = a; |
1502 b.computedText = c; | 1259 b.lastWord = axs.properties.getLastWord(a); |
1503 b.lastWord = axs.properties.getLastWord(c); | |
1504 return b; | 1260 return b; |
1505 }; | 1261 }; |
1506 axs.properties.getAriaProperties = function(a) { | 1262 axs.properties.getAriaProperties = function(a) { |
1507 var b = {}, c = axs.properties.getGlobalAriaProperties(a), d; | 1263 var b = {}, c = axs.properties.getGlobalAriaProperties(a), d; |
1508 for (d in axs.constants.ARIA_PROPERTIES) { | 1264 for (d in axs.constants.ARIA_PROPERTIES) { |
1509 var e = "aria-" + d; | 1265 var e = "aria-" + d; |
1510 if (a.hasAttribute(e)) { | 1266 if (a.hasAttribute(e)) { |
1511 var f = a.getAttribute(e); | 1267 var f = a.getAttribute(e); |
1512 c[e] = axs.utils.getAriaPropertyValue(e, f, a); | 1268 c[e] = axs.utils.getAriaPropertyValue(e, f, a); |
1513 } | 1269 } |
(...skipping 12 matching lines...) Expand all Loading... |
1526 if (h.details && h.details.propertiesSet) { | 1282 if (h.details && h.details.propertiesSet) { |
1527 for (d in h.details.propertiesSet) { | 1283 for (d in h.details.propertiesSet) { |
1528 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, vali
d:!1, reason:"Required property not set"})); | 1284 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, vali
d:!1, reason:"Required property not set"})); |
1529 } | 1285 } |
1530 } | 1286 } |
1531 } | 1287 } |
1532 0 < Object.keys(c).length && (b.properties = axs.utils.values(c)); | 1288 0 < Object.keys(c).length && (b.properties = axs.utils.values(c)); |
1533 return 0 < Object.keys(b).length ? b : null; | 1289 return 0 < Object.keys(b).length ? b : null; |
1534 }; | 1290 }; |
1535 axs.properties.getGlobalAriaProperties = function(a) { | 1291 axs.properties.getGlobalAriaProperties = function(a) { |
1536 var b = {}, c; | 1292 for (var b = {}, c = 0;c < axs.constants.GLOBAL_PROPERTIES.length;c++) { |
1537 for (c in axs.constants.GLOBAL_PROPERTIES) { | 1293 var d = axs.constants.GLOBAL_PROPERTIES[c]; |
1538 if (a.hasAttribute(c)) { | 1294 if (a.hasAttribute(d)) { |
1539 var d = a.getAttribute(c); | 1295 var e = a.getAttribute(d); |
1540 b[c] = axs.utils.getAriaPropertyValue(c, d, a); | 1296 b[d] = axs.utils.getAriaPropertyValue(d, e, a); |
1541 } | 1297 } |
1542 } | 1298 } |
1543 return b; | 1299 return b; |
1544 }; | 1300 }; |
1545 axs.properties.getVideoProperties = function(a) { | 1301 axs.properties.getVideoProperties = function(a) { |
1546 if (!axs.browserUtils.matchSelector(a, "video")) { | 1302 if (!axs.browserUtils.matchSelector(a, "video")) { |
1547 return null; | 1303 return null; |
1548 } | 1304 } |
1549 var b = {}; | 1305 var b = {}; |
1550 b.captionTracks = axs.properties.getTrackElements(a, "captions"); | 1306 b.captionTracks = axs.properties.getTrackElements(a, "captions"); |
(...skipping 14 matching lines...) Expand all Loading... |
1565 m && (h += m, k && (h += " ")); | 1321 m && (h += m, k && (h += " ")); |
1566 k && (h += "(" + k + ")"); | 1322 k && (h += "(" + k + ")"); |
1567 "" == h && (h = "[[object Object]]"); | 1323 "" == h && (h = "[[object Object]]"); |
1568 g.name = h; | 1324 g.name = h; |
1569 e.push(g); | 1325 e.push(g); |
1570 } | 1326 } |
1571 d.values = e; | 1327 d.values = e; |
1572 return d; | 1328 return d; |
1573 }; | 1329 }; |
1574 axs.properties.getAllProperties = function(a) { | 1330 axs.properties.getAllProperties = function(a) { |
1575 var b = axs.dom.asElement(a); | 1331 var b = axs.utils.asElement(a); |
1576 if (!b) { | 1332 if (!b) { |
1577 return {}; | 1333 return{}; |
1578 } | 1334 } |
1579 var c = {}; | 1335 var c = {}; |
1580 c.ariaProperties = axs.properties.getAriaProperties(b); | 1336 c.ariaProperties = axs.properties.getAriaProperties(b); |
1581 c.colorProperties = axs.properties.getColorProperties(b); | 1337 c.colorProperties = axs.properties.getColorProperties(b); |
1582 c.focusProperties = axs.properties.getFocusProperties(b); | 1338 c.focusProperties = axs.properties.getFocusProperties(b); |
1583 c.textProperties = axs.properties.getTextProperties(a); | 1339 c.textProperties = axs.properties.getTextProperties(a); |
1584 c.videoProperties = axs.properties.getVideoProperties(b); | 1340 c.videoProperties = axs.properties.getVideoProperties(b); |
1585 return c; | 1341 return c; |
1586 }; | 1342 }; |
1587 (function() { | |
1588 function a(a) { | |
1589 if (!a) { | |
1590 return null; | |
1591 } | |
1592 var c = a.tagName; | |
1593 if (!c) { | |
1594 return null; | |
1595 } | |
1596 c = c.toUpperCase(); | |
1597 c = axs.constants.TAG_TO_IMPLICIT_SEMANTIC_INFO[c]; | |
1598 if (!c || !c.length) { | |
1599 return null; | |
1600 } | |
1601 for (var d = null, e = 0, f = c.length;e < f;e++) { | |
1602 var g = c[e]; | |
1603 if (g.selector) { | |
1604 if (axs.browserUtils.matchSelector(a, g.selector)) { | |
1605 return g; | |
1606 } | |
1607 } else { | |
1608 d = g; | |
1609 } | |
1610 } | |
1611 return d; | |
1612 } | |
1613 axs.properties.getImplicitRole = function(b) { | |
1614 return (b = a(b)) ? b.role : ""; | |
1615 }; | |
1616 axs.properties.canTakeAriaAttributes = function(b) { | |
1617 return (b = a(b)) ? !b.reserved : !0; | |
1618 }; | |
1619 })(); | |
1620 axs.properties.getNativelySupportedAttributes = function(a) { | |
1621 var b = []; | |
1622 if (!a) { | |
1623 return b; | |
1624 } | |
1625 a = a.cloneNode(!1); | |
1626 for (var c = Object.keys(axs.constants.ARIA_TO_HTML_ATTRIBUTE), d = 0;d < c.le
ngth;d++) { | |
1627 var e = c[d]; | |
1628 axs.constants.ARIA_TO_HTML_ATTRIBUTE[e] in a && (b[b.length] = e); | |
1629 } | |
1630 return b; | |
1631 }; | |
1632 (function() { | |
1633 var a = {}; | |
1634 axs.properties.getSelectorForRole = function(b) { | |
1635 if (!b) { | |
1636 return ""; | |
1637 } | |
1638 if (a[b] && a.hasOwnProperty(b)) { | |
1639 return a[b]; | |
1640 } | |
1641 var c = ['[role="' + b + '"]']; | |
1642 Object.keys(axs.constants.TAG_TO_IMPLICIT_SEMANTIC_INFO).forEach(function(a)
{ | |
1643 var e = axs.constants.TAG_TO_IMPLICIT_SEMANTIC_INFO[a]; | |
1644 if (e && e.length) { | |
1645 for (var f = 0;f < e.length;f++) { | |
1646 var g = e[f]; | |
1647 if (g.role === b) { | |
1648 if (g.selector) { | |
1649 c[c.length] = g.selector; | |
1650 } else { | |
1651 c[c.length] = a; | |
1652 break; | |
1653 } | |
1654 } | |
1655 } | |
1656 } | |
1657 }); | |
1658 return a[b] = c.join(","); | |
1659 }; | |
1660 })(); | |
1661 axs.AuditRule = function(a) { | 1343 axs.AuditRule = function(a) { |
1662 for (var b = !0, c = [], d = 0;d < axs.AuditRule.requiredFields.length;d++) { | 1344 for (var b = !0, c = [], d = 0;d < axs.AuditRule.requiredFields.length;d++) { |
1663 var e = axs.AuditRule.requiredFields[d]; | 1345 var e = axs.AuditRule.requiredFields[d]; |
1664 e in a || (b = !1, c.push(e)); | 1346 e in a || (b = !1, c.push(e)); |
1665 } | 1347 } |
1666 if (!b) { | 1348 if (!b) { |
1667 throw "Invalid spec; the following fields were not specified: " + c.join(",
") + "\n" + JSON.stringify(a); | 1349 throw "Invalid spec; the following fields were not specified: " + c.join(",
") + "\n" + JSON.stringify(a); |
1668 } | 1350 } |
1669 this.name = a.name; | 1351 this.name = a.name; |
1670 this.severity = a.severity; | 1352 this.severity = a.severity; |
1671 this.relevantElementMatcher_ = a.relevantElementMatcher; | 1353 this.relevantElementMatcher_ = a.relevantElementMatcher; |
1672 this.test_ = a.test; | 1354 this.test_ = a.test; |
1673 this.code = a.code; | 1355 this.code = a.code; |
1674 this.heading = a.heading || ""; | 1356 this.heading = a.heading || ""; |
1675 this.url = a.url || ""; | 1357 this.url = a.url || ""; |
1676 this.requiresConsoleAPI = !!a.opt_requiresConsoleAPI; | 1358 this.requiresConsoleAPI = !!a.opt_requiresConsoleAPI; |
1677 }; | 1359 }; |
1678 axs.AuditRule.requiredFields = "name severity relevantElementMatcher test code h
eading".split(" "); | 1360 axs.AuditRule.requiredFields = "name severity relevantElementMatcher test code h
eading".split(" "); |
1679 axs.AuditRule.NOT_APPLICABLE = {result:axs.constants.AuditResult.NA}; | 1361 axs.AuditRule.NOT_APPLICABLE = {result:axs.constants.AuditResult.NA}; |
1680 axs.AuditRule.prototype.addElement = function(a, b) { | 1362 axs.AuditRule.prototype.addElement = function(a, b) { |
1681 a.push(b); | 1363 a.push(b); |
1682 }; | 1364 }; |
1683 axs.AuditRule.collectMatchingElements = function(a, b, c, d) { | 1365 axs.AuditRule.collectMatchingElements = function(a, b, c, d) { |
1684 axs.dom.composedTreeSearch(a, null, {preorder:function(a) { | 1366 if (a.nodeType == Node.ELEMENT_NODE) { |
1685 if (d) { | 1367 var e = a |
1686 for (var f = 0;f < d.length;f++) { | 1368 } |
1687 if (axs.browserUtils.matchSelector(a, d[f])) { | 1369 e && b.call(null, e) && c.push(e); |
1688 return !1; | 1370 if (e) { |
1689 } | 1371 var f = e.shadowRoot || e.webkitShadowRoot; |
| 1372 if (f) { |
| 1373 axs.AuditRule.collectMatchingElements(f, b, c, f); |
| 1374 return; |
| 1375 } |
| 1376 } |
| 1377 if (e && "content" == e.localName) { |
| 1378 for (e = e.getDistributedNodes(), a = 0;a < e.length;a++) { |
| 1379 axs.AuditRule.collectMatchingElements(e[a], b, c, d); |
| 1380 } |
| 1381 } else { |
| 1382 if (e && "shadow" == e.localName) { |
| 1383 a = e, d ? (d = d.olderShadowRoot || a.olderShadowRoot) && axs.AuditRule.c
ollectMatchingElements(d, b, c, d) : console.warn("ShadowRoot not provided for",
e); |
| 1384 } else { |
| 1385 for (e = a.firstChild;null != e;) { |
| 1386 axs.AuditRule.collectMatchingElements(e, b, c, d), e = e.nextSibling; |
1690 } | 1387 } |
1691 } | 1388 } |
1692 b(a) && c.push(a); | 1389 } |
1693 return !0; | |
1694 }}); | |
1695 }; | 1390 }; |
1696 axs.AuditRule.prototype.run = function(a) { | 1391 axs.AuditRule.prototype.run = function(a) { |
1697 a = a || {}; | 1392 a = a || {}; |
1698 var b = "maxResults" in a ? a.maxResults : null, c = []; | 1393 var b = "ignoreSelectors" in a ? a.ignoreSelectors : [], c = "maxResults" in a
? a.maxResults : null, d = []; |
1699 axs.AuditRule.collectMatchingElements("scope" in a ? a.scope : document, this.
relevantElementMatcher_, c, a.ignoreSelectors); | 1394 axs.AuditRule.collectMatchingElements("scope" in a ? a.scope : document, this.
relevantElementMatcher_, d); |
1700 var d = []; | 1395 var e = []; |
1701 if (!c.length) { | 1396 if (!d.length) { |
1702 return {result:axs.constants.AuditResult.NA}; | 1397 return{result:axs.constants.AuditResult.NA}; |
1703 } | 1398 } |
1704 for (var e = 0;e < c.length && !(null != b && d.length >= b);e++) { | 1399 for (a = 0;a < d.length && !(null != c && e.length >= c);a++) { |
1705 var f = c[e]; | 1400 var f = d[a], g; |
1706 this.test_(f, a.config) && this.addElement(d, f); | 1401 a: { |
| 1402 g = f; |
| 1403 for (var h = 0;h < b.length;h++) { |
| 1404 if (axs.browserUtils.matchSelector(g, b[h])) { |
| 1405 g = !0; |
| 1406 break a; |
| 1407 } |
| 1408 } |
| 1409 g = !1; |
| 1410 } |
| 1411 !g && this.test_(f) && this.addElement(e, f); |
1707 } | 1412 } |
1708 a = {result:d.length ? axs.constants.AuditResult.FAIL : axs.constants.AuditRes
ult.PASS, elements:d}; | 1413 b = {result:e.length ? axs.constants.AuditResult.FAIL : axs.constants.AuditRes
ult.PASS, elements:e}; |
1709 e < c.length && (a.resultsTruncated = !0); | 1414 a < d.length && (b.resultsTruncated = !0); |
1710 return a; | 1415 return b; |
1711 }; | 1416 }; |
| 1417 axs.AuditRule.specs = {}; |
1712 axs.AuditRules = {}; | 1418 axs.AuditRules = {}; |
1713 (function() { | 1419 axs.AuditRules.getRule = function(a) { |
1714 var a = {}, b = {}; | 1420 if (!axs.AuditRules.rules) { |
1715 axs.AuditRules.specs = {}; | 1421 axs.AuditRules.rules = {}; |
1716 axs.AuditRules.addRule = function(c) { | 1422 for (var b in axs.AuditRule.specs) { |
1717 var d = new axs.AuditRule(c); | 1423 var c = axs.AuditRule.specs[b], d = new axs.AuditRule(c); |
1718 if (d.code in b) { | 1424 axs.AuditRules.rules[c.name] = d; |
1719 throw Error('Can not add audit rule with same code: "' + d.code + '"'); | |
1720 } | 1425 } |
1721 if (d.name in a) { | 1426 } |
1722 throw Error('Can not add audit rule with same name: "' + d.name + '"'); | 1427 return axs.AuditRules.rules[a]; |
1723 } | 1428 }; |
1724 a[d.name] = b[d.code] = d; | |
1725 axs.AuditRules.specs[c.name] = c; | |
1726 }; | |
1727 axs.AuditRules.getRule = function(c) { | |
1728 return a[c] || b[c] || null; | |
1729 }; | |
1730 axs.AuditRules.getRules = function(b) { | |
1731 var d = Object.keys(a); | |
1732 return b ? d : d.map(function(a) { | |
1733 return this.getRule(a); | |
1734 }, axs.AuditRules); | |
1735 }; | |
1736 })(); | |
1737 axs.AuditResults = function() { | 1429 axs.AuditResults = function() { |
1738 this.errors_ = []; | 1430 this.errors_ = []; |
1739 this.warnings_ = []; | 1431 this.warnings_ = []; |
1740 }; | 1432 }; |
1741 goog.exportSymbol("axs.AuditResults", axs.AuditResults); | 1433 goog.exportSymbol("axs.AuditResults", axs.AuditResults); |
1742 axs.AuditResults.prototype.addError = function(a) { | 1434 axs.AuditResults.prototype.addError = function(a) { |
1743 "" != a && this.errors_.push(a); | 1435 "" != a && this.errors_.push(a); |
1744 }; | 1436 }; |
1745 goog.exportProperty(axs.AuditResults.prototype, "addError", axs.AuditResults.pro
totype.addError); | 1437 goog.exportProperty(axs.AuditResults.prototype, "addError", axs.AuditResults.pro
totype.addError); |
1746 axs.AuditResults.prototype.addWarning = function(a) { | 1438 axs.AuditResults.prototype.addWarning = function(a) { |
(...skipping 21 matching lines...) Expand all Loading... |
1768 0 == b && (a += "\nErrors:\n"); | 1460 0 == b && (a += "\nErrors:\n"); |
1769 var c = this.errors_[b], a = a + (c + "\n\n"); | 1461 var c = this.errors_[b], a = a + (c + "\n\n"); |
1770 } | 1462 } |
1771 for (b = 0;b < this.warnings_.length;b++) { | 1463 for (b = 0;b < this.warnings_.length;b++) { |
1772 0 == b && (a += "\nWarnings:\n"), c = this.warnings_[b], a += c + "\n\n"; | 1464 0 == b && (a += "\nWarnings:\n"), c = this.warnings_[b], a += c + "\n\n"; |
1773 } | 1465 } |
1774 return a; | 1466 return a; |
1775 }; | 1467 }; |
1776 goog.exportProperty(axs.AuditResults.prototype, "toString", axs.AuditResults.pro
totype.toString); | 1468 goog.exportProperty(axs.AuditResults.prototype, "toString", axs.AuditResults.pro
totype.toString); |
1777 axs.Audit = {}; | 1469 axs.Audit = {}; |
1778 axs.AuditConfiguration = function(a) { | 1470 axs.AuditConfiguration = function() { |
1779 null == a && (a = {}); | |
1780 this.rules_ = {}; | 1471 this.rules_ = {}; |
1781 this.maxResults = this.auditRulesToIgnore = this.auditRulesToRun = this.scope
= null; | 1472 this.maxResults = this.auditRulesToIgnore = this.auditRulesToRun = this.scope
= null; |
1782 this.withConsoleApi = !1; | 1473 this.withConsoleApi = !1; |
1783 this.showUnsupportedRulesWarning = !0; | 1474 this.showUnsupportedRulesWarning = !0; |
1784 for (var b in this) { | |
1785 this.hasOwnProperty(b) && b in a && (this[b] = a[b]); | |
1786 } | |
1787 goog.exportProperty(this, "scope", this.scope); | 1475 goog.exportProperty(this, "scope", this.scope); |
1788 goog.exportProperty(this, "auditRulesToRun", this.auditRulesToRun); | 1476 goog.exportProperty(this, "auditRulesToRun", this.auditRulesToRun); |
1789 goog.exportProperty(this, "auditRulesToIgnore", this.auditRulesToIgnore); | 1477 goog.exportProperty(this, "auditRulesToIgnore", this.auditRulesToIgnore); |
1790 goog.exportProperty(this, "withConsoleApi", this.withConsoleApi); | 1478 goog.exportProperty(this, "withConsoleApi", this.withConsoleApi); |
1791 goog.exportProperty(this, "showUnsupportedRulesWarning", this.showUnsupportedR
ulesWarning); | 1479 goog.exportProperty(this, "showUnsupportedRulesWarning", this.showUnsupportedR
ulesWarning); |
1792 }; | 1480 }; |
1793 goog.exportSymbol("axs.AuditConfiguration", axs.AuditConfiguration); | 1481 goog.exportSymbol("axs.AuditConfiguration", axs.AuditConfiguration); |
1794 axs.AuditConfiguration.prototype = {ignoreSelectors:function(a, b) { | 1482 axs.AuditConfiguration.prototype = {ignoreSelectors:function(a, b) { |
1795 a in this.rules_ || (this.rules_[a] = {}); | 1483 a in this.rules_ || (this.rules_[a] = {}); |
1796 "ignore" in this.rules_[a] || (this.rules_[a].ignore = []); | 1484 "ignore" in this.rules_[a] || (this.rules_[a].ignore = []); |
1797 Array.prototype.push.call(this.rules_[a].ignore, b); | 1485 Array.prototype.push.call(this.rules_[a].ignore, b); |
1798 }, getIgnoreSelectors:function(a) { | 1486 }, getIgnoreSelectors:function(a) { |
1799 return a in this.rules_ && "ignore" in this.rules_[a] ? this.rules_[a].ignore
: []; | 1487 return a in this.rules_ && "ignore" in this.rules_[a] ? this.rules_[a].ignore
: []; |
1800 }, setSeverity:function(a, b) { | 1488 }, setSeverity:function(a, b) { |
1801 a in this.rules_ || (this.rules_[a] = {}); | 1489 a in this.rules_ || (this.rules_[a] = {}); |
1802 this.rules_[a].severity = b; | 1490 this.rules_[a].severity = b; |
1803 }, getSeverity:function(a) { | 1491 }, getSeverity:function(a) { |
1804 return a in this.rules_ && "severity" in this.rules_[a] ? this.rules_[a].sever
ity : null; | 1492 return a in this.rules_ && "severity" in this.rules_[a] ? this.rules_[a].sever
ity : null; |
1805 }, setRuleConfig:function(a, b) { | |
1806 a in this.rules_ || (this.rules_[a] = {}); | |
1807 this.rules_[a].config = b; | |
1808 }, getRuleConfig:function(a) { | |
1809 return a in this.rules_ && "config" in this.rules_[a] ? this.rules_[a].config
: null; | |
1810 }}; | 1493 }}; |
1811 goog.exportProperty(axs.AuditConfiguration.prototype, "ignoreSelectors", axs.Aud
itConfiguration.prototype.ignoreSelectors); | 1494 goog.exportProperty(axs.AuditConfiguration.prototype, "ignoreSelectors", axs.Aud
itConfiguration.prototype.ignoreSelectors); |
1812 goog.exportProperty(axs.AuditConfiguration.prototype, "getIgnoreSelectors", axs.
AuditConfiguration.prototype.getIgnoreSelectors); | 1495 goog.exportProperty(axs.AuditConfiguration.prototype, "getIgnoreSelectors", axs.
AuditConfiguration.prototype.getIgnoreSelectors); |
1813 axs.Audit.unsupportedRulesWarningShown = !1; | 1496 axs.Audit.unsupportedRulesWarningShown = !1; |
1814 axs.Audit.getRulesCannotRun = function(a) { | 1497 axs.Audit.getRulesCannotRun = function(a) { |
1815 return a.withConsoleApi ? [] : axs.AuditRules.getRules().filter(function(a) { | 1498 return a.withConsoleApi ? [] : Object.keys(axs.AuditRule.specs).filter(functio
n(a) { |
1816 return a.requiresConsoleAPI; | 1499 return axs.AuditRules.getRule(a).requiresConsoleAPI; |
1817 }).map(function(a) { | 1500 }).map(function(a) { |
1818 return a.code; | 1501 return axs.AuditRules.getRule(a).code; |
1819 }); | 1502 }); |
1820 }; | 1503 }; |
1821 axs.Audit.run = function(a) { | 1504 axs.Audit.run = function(a) { |
1822 a = a || new axs.AuditConfiguration; | 1505 a = a || new axs.AuditConfiguration; |
1823 var b = a.withConsoleApi, c = [], d; | 1506 var b = a.withConsoleApi, c = [], d; |
1824 d = a.auditRulesToRun && 0 < a.auditRulesToRun.length ? a.auditRulesToRun : ax
s.AuditRules.getRules(!0); | 1507 d = a.auditRulesToRun && 0 < a.auditRulesToRun.length ? a.auditRulesToRun : Ob
ject.keys(axs.AuditRule.specs); |
1825 if (a.auditRulesToIgnore) { | 1508 if (a.auditRulesToIgnore) { |
1826 for (var e = 0;e < a.auditRulesToIgnore.length;e++) { | 1509 for (var e = 0;e < a.auditRulesToIgnore.length;e++) { |
1827 var f = a.auditRulesToIgnore[e]; | 1510 var f = a.auditRulesToIgnore[e]; |
1828 0 > d.indexOf(f) || d.splice(d.indexOf(f), 1); | 1511 0 > d.indexOf(f) || d.splice(d.indexOf(f), 1); |
1829 } | 1512 } |
1830 } | 1513 } |
1831 !axs.Audit.unsupportedRulesWarningShown && a.showUnsupportedRulesWarning && (e
= axs.Audit.getRulesCannotRun(a), 0 < e.length && (console.warn("Some rules can
not be checked using the axs.Audit.run() method call. Use the Chrome plugin to c
heck these rules: " + e.join(", ")), console.warn("To remove this message, pass
an AuditConfiguration object to axs.Audit.run() and set configuration.showUnsupp
ortedRulesWarning = false.")), axs.Audit.unsupportedRulesWarningShown = !0); | 1514 !axs.Audit.unsupportedRulesWarningShown && a.showUnsupportedRulesWarning && (e
= axs.Audit.getRulesCannotRun(a), 0 < e.length && (console.warn("Some rules can
not be checked using the axs.Audit.run() method call. Use the Chrome plugin to c
heck these rules: " + e.join(", ")), console.warn("To remove this message, pass
an AuditConfiguration object to axs.Audit.run() and set configuration.showUnsupp
ortedRulesWarning = false.")), axs.Audit.unsupportedRulesWarningShown = !0); |
1832 for (e = 0;e < d.length;e++) { | 1515 for (e = 0;e < d.length;e++) { |
1833 var f = d[e], g = axs.AuditRules.getRule(f); | 1516 var f = d[e], g = axs.AuditRules.getRule(f); |
1834 if (g && !g.disabled && (b || !g.requiresConsoleAPI)) { | 1517 if (g && !g.disabled && (b || !g.requiresConsoleAPI)) { |
1835 var h = {}, k = a.getIgnoreSelectors(g.name); | 1518 var h = {}, k = a.getIgnoreSelectors(g.name); |
1836 if (0 < k.length || a.scope) { | 1519 if (0 < k.length || a.scope) { |
1837 h.ignoreSelectors = k; | 1520 h.ignoreSelectors = k; |
1838 } | 1521 } |
1839 k = a.getRuleConfig(g.name); | |
1840 null != k && (h.config = k); | |
1841 a.scope && (h.scope = a.scope); | 1522 a.scope && (h.scope = a.scope); |
1842 a.maxResults && (h.maxResults = a.maxResults); | 1523 a.maxResults && (h.maxResults = a.maxResults); |
1843 h = g.run.call(g, h); | 1524 h = g.run.call(g, h); |
1844 g = axs.utils.namedValues(g); | 1525 g = axs.utils.namedValues(g); |
1845 g.severity = a.getSeverity(f) || g.severity; | 1526 g.severity = a.getSeverity(f) || g.severity; |
1846 h.rule = g; | 1527 h.rule = g; |
1847 c.push(h); | 1528 c.push(h); |
1848 } | 1529 } |
1849 } | 1530 } |
1850 return c; | 1531 return c; |
(...skipping 20 matching lines...) Expand all Loading... |
1871 try { | 1552 try { |
1872 b += axs.utils.getQuerySelectorText(e); | 1553 b += axs.utils.getQuerySelectorText(e); |
1873 } catch (f) { | 1554 } catch (f) { |
1874 b += " tagName:" + e.tagName, b += " id:" + e.id; | 1555 b += " tagName:" + e.tagName, b += " id:" + e.id; |
1875 } | 1556 } |
1876 } | 1557 } |
1877 "" != a.rule.url && (b += "\nSee " + a.rule.url + " for more information."); | 1558 "" != a.rule.url && (b += "\nSee " + a.rule.url + " for more information."); |
1878 return b; | 1559 return b; |
1879 }; | 1560 }; |
1880 goog.exportSymbol("axs.Audit.accessibilityErrorMessage", axs.Audit.accessibility
ErrorMessage); | 1561 goog.exportSymbol("axs.Audit.accessibilityErrorMessage", axs.Audit.accessibility
ErrorMessage); |
1881 axs.AuditRules.addRule({name:"ariaOnReservedElement", heading:"This element does
not support ARIA roles, states and properties", url:"https://github.com/GoogleC
hrome/accessibility-developer-tools/wiki/Audit-Rules#ax_aria_12", severity:axs.c
onstants.Severity.WARNING, relevantElementMatcher:function(a) { | 1562 axs.AuditRule.specs.audioWithoutControls = {name:"audioWithoutControls", heading
:"Audio elements should have controls", url:"", severity:axs.constants.Severity.
WARNING, relevantElementMatcher:function(a) { |
1882 return !axs.properties.canTakeAriaAttributes(a); | |
1883 }, test:function(a) { | |
1884 return null !== axs.properties.getAriaProperties(a); | |
1885 }, code:"AX_ARIA_12"}); | |
1886 axs.AuditRules.addRule({name:"ariaOwnsDescendant", heading:"aria-owns should not
be used if ownership is implicit in the DOM", url:"https://github.com/GoogleChr
ome/accessibility-developer-tools/wiki/Audit-Rules#ax_aria_06", severity:axs.con
stants.Severity.WARNING, relevantElementMatcher:function(a) { | |
1887 return axs.browserUtils.matchSelector(a, "[aria-owns]"); | |
1888 }, test:function(a) { | |
1889 return axs.utils.getIdReferents("aria-owns", a).some(function(b) { | |
1890 return a.compareDocumentPosition(b) & Node.DOCUMENT_POSITION_CONTAINED_BY; | |
1891 }); | |
1892 }, code:"AX_ARIA_06"}); | |
1893 axs.AuditRules.addRule({name:"ariaRoleNotScoped", heading:"Elements with ARIA ro
les must be in the correct scope", url:"https://github.com/GoogleChrome/accessib
ility-developer-tools/wiki/Audit-Rules#ax_aria_09", severity:axs.constants.Sever
ity.SEVERE, relevantElementMatcher:function(a) { | |
1894 return axs.browserUtils.matchSelector(a, "[role]"); | |
1895 }, test:function(a) { | |
1896 var b = axs.utils.getRoles(a); | |
1897 if (!b || !b.applied) { | |
1898 return !1; | |
1899 } | |
1900 b = b.applied.details.scope; | |
1901 if (!b || 0 === b.length) { | |
1902 return !1; | |
1903 } | |
1904 for (var c = a;c = axs.dom.parentElement(c);) { | |
1905 var d = axs.utils.getRoles(c, !0); | |
1906 if (d && d.applied && 0 <= b.indexOf(d.applied.name)) { | |
1907 return !1; | |
1908 } | |
1909 } | |
1910 if (a = axs.utils.getAriaIdReferrers(a, "aria-owns")) { | |
1911 for (c = 0;c < a.length;c++) { | |
1912 if ((d = axs.utils.getRoles(a[c], !0)) && d.applied && 0 <= b.indexOf(d.ap
plied.name)) { | |
1913 return !1; | |
1914 } | |
1915 } | |
1916 } | |
1917 return !0; | |
1918 }, code:"AX_ARIA_09"}); | |
1919 axs.AuditRules.addRule({name:"audioWithoutControls", heading:"Audio elements sho
uld have controls", url:"https://github.com/GoogleChrome/accessibility-developer
-tools/wiki/Audit-Rules#ax_audio_01", severity:axs.constants.Severity.WARNING, r
elevantElementMatcher:function(a) { | |
1920 return axs.browserUtils.matchSelector(a, "audio[autoplay]"); | 1563 return axs.browserUtils.matchSelector(a, "audio[autoplay]"); |
1921 }, test:function(a) { | 1564 }, test:function(a) { |
1922 return !a.querySelectorAll("[controls]").length && 3 < a.duration; | 1565 return!a.querySelectorAll("[controls]").length && 3 < a.duration; |
1923 }, code:"AX_AUDIO_01"}); | 1566 }, code:"AX_AUDIO_01"}; |
1924 (function() { | 1567 axs.AuditRule.specs.badAriaAttributeValue = {name:"badAriaAttributeValue", headi
ng:"ARIA state and property values must be valid", url:"", severity:axs.constant
s.Severity.SEVERE, relevantElementMatcher:function(a) { |
1925 var a = /^aria\-/; | 1568 var b = "", c; |
1926 axs.AuditRules.addRule({name:"badAriaAttribute", heading:"This element has an
invalid ARIA attribute", url:"https://github.com/GoogleChrome/accessibility-deve
loper-tools/wiki/Audit-Rules#ax_aria_11", severity:axs.constants.Severity.WARNIN
G, relevantElementMatcher:function(b) { | 1569 for (c in axs.constants.ARIA_PROPERTIES) { |
1927 b = b.attributes; | 1570 b += "[aria-" + c + "],"; |
1928 for (var c = 0, d = b.length;c < d;c++) { | 1571 } |
1929 if (a.test(b[c].name)) { | 1572 b = b.substring(0, b.length - 1); |
1930 return !0; | |
1931 } | |
1932 } | |
1933 return !1; | |
1934 }, test:function(b) { | |
1935 b = b.attributes; | |
1936 for (var c = 0, d = b.length;c < d;c++) { | |
1937 var e = b[c].name; | |
1938 if (a.test(e) && (e = e.replace(a, ""), !axs.constants.ARIA_PROPERTIES.has
OwnProperty(e))) { | |
1939 return !0; | |
1940 } | |
1941 } | |
1942 return !1; | |
1943 }, code:"AX_ARIA_11"}); | |
1944 })(); | |
1945 axs.AuditRules.addRule({name:"badAriaAttributeValue", heading:"ARIA state and pr
operty values must be valid", url:"https://github.com/GoogleChrome/accessibility
-developer-tools/wiki/Audit-Rules#ax_aria_04", severity:axs.constants.Severity.S
EVERE, relevantElementMatcher:function(a) { | |
1946 var b = axs.utils.getSelectorForAriaProperties(axs.constants.ARIA_PROPERTIES); | |
1947 return axs.browserUtils.matchSelector(a, b); | 1573 return axs.browserUtils.matchSelector(a, b); |
1948 }, test:function(a) { | 1574 }, test:function(a) { |
1949 for (var b in axs.constants.ARIA_PROPERTIES) { | 1575 for (var b in axs.constants.ARIA_PROPERTIES) { |
1950 var c = "aria-" + b; | 1576 var c = "aria-" + b; |
1951 if (a.hasAttribute(c)) { | 1577 if (a.hasAttribute(c)) { |
1952 var d = a.getAttribute(c); | 1578 var d = a.getAttribute(c); |
1953 if (!axs.utils.getAriaPropertyValue(c, d, a).valid) { | 1579 if (!axs.utils.getAriaPropertyValue(c, d, a).valid) { |
1954 return !0; | 1580 return!0; |
1955 } | 1581 } |
1956 } | 1582 } |
1957 } | 1583 } |
1958 return !1; | 1584 return!1; |
1959 }, code:"AX_ARIA_04"}); | 1585 }, code:"AX_ARIA_04"}; |
1960 axs.AuditRules.addRule({name:"badAriaRole", heading:"Elements with ARIA roles mu
st use a valid, non-abstract ARIA role", url:"https://github.com/GoogleChrome/ac
cessibility-developer-tools/wiki/Audit-Rules#ax_aria_01", severity:axs.constants
.Severity.SEVERE, relevantElementMatcher:function(a) { | 1586 axs.AuditRule.specs.badAriaRole = {name:"badAriaRole", heading:"Elements with AR
IA roles must use a valid, non-abstract ARIA role", url:"https://github.com/Goog
leChrome/accessibility-developer-tools/wiki/Audit-Rules#-ax_aria_01--elements-wi
th-aria-roles-must-use-a-valid-non-abstract-aria-role", severity:axs.constants.S
everity.SEVERE, relevantElementMatcher:function(a) { |
1961 return axs.browserUtils.matchSelector(a, "[role]"); | 1587 return axs.browserUtils.matchSelector(a, "[role]"); |
1962 }, test:function(a) { | 1588 }, test:function(a) { |
1963 return !axs.utils.getRoles(a).valid; | 1589 return!axs.utils.getRoles(a).valid; |
1964 }, code:"AX_ARIA_01"}); | 1590 }, code:"AX_ARIA_01"}; |
1965 axs.AuditRules.addRule({name:"controlsWithoutLabel", heading:"Controls and media
elements should have labels", url:"https://github.com/GoogleChrome/accessibilit
y-developer-tools/wiki/Audit-Rules#ax_text_01", severity:axs.constants.Severity.
SEVERE, relevantElementMatcher:function(a) { | 1591 axs.AuditRule.specs.controlsWithoutLabel = {name:"controlsWithoutLabel", heading
:"Controls and media elements should have labels", url:"https://github.com/Googl
eChrome/accessibility-developer-tools/wiki/Audit-Rules#-ax_text_01--controls-and
-media-elements-should-have-labels", severity:axs.constants.Severity.SEVERE, rel
evantElementMatcher:function(a) { |
1966 if (!axs.browserUtils.matchSelector(a, 'input:not([type="hidden"]):not([disabl
ed]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]),
video:not([disabled])') || "presentation" == a.getAttribute("role")) { | 1592 if (!axs.browserUtils.matchSelector(a, 'input:not([type="hidden"]):not([disabl
ed]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]),
video:not([disabled])')) { |
1967 return !1; | 1593 return!1; |
1968 } | 1594 } |
1969 if (0 <= a.tabIndex) { | 1595 if (0 <= a.tabIndex) { |
1970 return !0; | 1596 return!0; |
1971 } | 1597 } |
1972 for (a = axs.dom.parentElement(a);null != a;a = axs.dom.parentElement(a)) { | 1598 for (a = axs.utils.parentElement(a);null != a;a = axs.utils.parentElement(a))
{ |
1973 if (axs.utils.elementIsAriaWidget(a)) { | 1599 if (axs.utils.elementIsAriaWidget(a)) { |
1974 return !1; | 1600 return!1; |
1975 } | 1601 } |
1976 } | 1602 } |
1977 return !0; | 1603 return!0; |
1978 }, test:function(a) { | 1604 }, test:function(a) { |
1979 if (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 || axs.utils.hasLabel(a)) { | 1605 return axs.utils.isElementOrAncestorHidden(a) || "input" == a.tagName.toLowerC
ase() && "button" == a.type && a.value.length || "button" == a.tagName.toLowerCa
se() && a.textContent.replace(/^\s+|\s+$/g, "").length ? !1 : axs.utils.hasLabel
(a) ? !1 : !0; |
1980 return !1; | 1606 }, code:"AX_TEXT_01", ruleName:"Controls and media elements should have labels"}
; |
1981 } | 1607 axs.AuditRule.specs.focusableElementNotVisibleAndNotAriaHidden = {name:"focusabl
eElementNotVisibleAndNotAriaHidden", heading:"These elements are focusable but e
ither invisible or obscured by another element", url:"https://github.com/GoogleC
hrome/accessibility-developer-tools/wiki/Audit-Rules#-ax_focus_01--these-element
s-are-focusable-but-either-invisible-or-obscured-by-another-element", severity:a
xs.constants.Severity.WARNING, relevantElementMatcher:function(a) { |
1982 a = axs.properties.findTextAlternatives(a, {}); | |
1983 return null === a || "" === a.trim() ? !0 : !1; | |
1984 }, code:"AX_TEXT_01", ruleName:"Controls and media elements should have labels"}
); | |
1985 axs.AuditRules.addRule({name:"duplicateId", heading:"Any ID referred to via an I
DREF must be unique in the DOM", url:"https://github.com/GoogleChrome/accessibil
ity-developer-tools/wiki/Audit-Rules#ax_html_02", severity:axs.constants.Severit
y.SEVERE, relevantElementMatcher:function(a) { | |
1986 return a.hasAttribute("id") ? axs.utils.getIdReferrers(a).some(function(a) { | |
1987 return !axs.utils.isElementOrAncestorHidden(a); | |
1988 }) : !1; | |
1989 }, test:function(a) { | |
1990 var b = "[id='" + a.id.replace(/'/g, "\\'") + "']"; | |
1991 return 1 < a.ownerDocument.querySelectorAll(b).length; | |
1992 }, code:"AX_HTML_02"}); | |
1993 axs.AuditRules.addRule({name:"focusableElementNotVisibleAndNotAriaHidden", headi
ng:"These elements are focusable but either invisible or obscured by another ele
ment", url:"https://github.com/GoogleChrome/accessibility-developer-tools/wiki/A
udit-Rules#ax_focus_01", severity:axs.constants.Severity.WARNING, relevantElemen
tMatcher:function(a) { | |
1994 if (!axs.browserUtils.matchSelector(a, axs.utils.FOCUSABLE_ELEMENTS_SELECTOR))
{ | 1608 if (!axs.browserUtils.matchSelector(a, axs.utils.FOCUSABLE_ELEMENTS_SELECTOR))
{ |
1995 return !1; | 1609 return!1; |
1996 } | 1610 } |
1997 if (0 <= a.tabIndex) { | 1611 if (0 <= a.tabIndex) { |
1998 return !0; | 1612 return!0; |
1999 } | 1613 } |
2000 for (var b = axs.dom.parentElement(a);null != b;b = axs.dom.parentElement(b))
{ | 1614 for (a = axs.utils.parentElement(a);null != a;a = axs.utils.parentElement(a))
{ |
2001 if (axs.utils.elementIsAriaWidget(b)) { | 1615 if (axs.utils.elementIsAriaWidget(a)) { |
2002 return !1; | 1616 return!1; |
2003 } | 1617 } |
2004 } | 1618 } |
2005 a = axs.properties.findTextAlternatives(a, {}); | 1619 return!0; |
2006 return null === a || "" === a.trim() ? !1 : !0; | |
2007 }, test:function(a) { | 1620 }, test:function(a) { |
2008 if (axs.utils.isElementOrAncestorHidden(a)) { | 1621 if (axs.utils.isElementOrAncestorHidden(a)) { |
2009 return !1; | 1622 return!1; |
2010 } | 1623 } |
2011 a.focus(); | 1624 a.focus(); |
2012 return !axs.utils.elementIsVisible(a); | 1625 return!axs.utils.elementIsVisible(a); |
2013 }, code:"AX_FOCUS_01"}); | 1626 }, code:"AX_FOCUS_01"}; |
2014 axs.AuditRules.addRule({name:"humanLangMissing", heading:"The web page should ha
ve the content's human language indicated in the markup", url:"https://github.co
m/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules#ax_html_01", sever
ity:axs.constants.Severity.WARNING, relevantElementMatcher:function(a) { | 1627 axs.AuditRule.specs.imagesWithoutAltText = {name:"imagesWithoutAltText", heading
:"Images should have an alt attribute", url:"https://github.com/GoogleChrome/acc
essibility-developer-tools/wiki/Audit-Rules#-ax_text_02--images-should-have-an-a
lt-attribute-unless-they-have-an-aria-role-of-presentation", severity:axs.consta
nts.Severity.WARNING, relevantElementMatcher:function(a) { |
2015 return a instanceof a.ownerDocument.defaultView.HTMLHtmlElement; | |
2016 }, test:function(a) { | |
2017 return a.lang ? !1 : !0; | |
2018 }, code:"AX_HTML_01"}); | |
2019 axs.AuditRules.addRule({name:"imagesWithoutAltText", heading:"Images should have
a text alternative or presentational role", url:"https://github.com/GoogleChrom
e/accessibility-developer-tools/wiki/Audit-Rules#ax_text_02", severity:axs.const
ants.Severity.WARNING, relevantElementMatcher:function(a) { | |
2020 return axs.browserUtils.matchSelector(a, "img") && !axs.utils.isElementOrAnces
torHidden(a); | 1628 return axs.browserUtils.matchSelector(a, "img") && !axs.utils.isElementOrAnces
torHidden(a); |
2021 }, test:function(a) { | 1629 }, test:function(a) { |
2022 if (a.hasAttribute("alt") && "" == a.alt || "presentation" == a.getAttribute("
role")) { | 1630 return!a.hasAttribute("alt") && "presentation" != a.getAttribute("role"); |
2023 return !1; | 1631 }, code:"AX_TEXT_02"}; |
2024 } | 1632 axs.AuditRule.specs.linkWithUnclearPurpose = {name:"linkWithUnclearPurpose", hea
ding:"The purpose of each link should be clear from the link text", url:"", seve
rity:axs.constants.Severity.WARNING, relevantElementMatcher:function(a) { |
2025 var b = {}; | 1633 return axs.browserUtils.matchSelector(a, "a"); |
2026 axs.properties.findTextAlternatives(a, b); | 1634 }, test:function(a) { |
2027 return 0 == Object.keys(b).length ? !0 : !1; | 1635 return/^\s*click\s*here\s*[^a-z]?$/i.test(a.textContent); |
2028 }, code:"AX_TEXT_02"}); | 1636 }, code:"AX_TITLE_01"}; |
2029 axs.AuditRules.addRule({name:"linkWithUnclearPurpose", heading:"The purpose of e
ach link should be clear from the link text", url:"https://github.com/GoogleChro
me/accessibility-developer-tools/wiki/Audit-Rules#ax_text_04", severity:axs.cons
tants.Severity.WARNING, relevantElementMatcher:function(a) { | 1637 axs.AuditRule.specs.lowContrastElements = {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-e
lements-should-have-a-reasonable-contrast-ratio", severity:axs.constants.Severit
y.WARNING, relevantElementMatcher:function(a) { |
2030 return axs.browserUtils.matchSelector(a, "a[href]") && !axs.utils.isElementOrA
ncestorHidden(a); | 1638 return axs.properties.hasDirectTextDescendant(a); |
2031 }, test:function(a, b) { | |
2032 for (var c = b || {}, d = c.blacklistPhrases || [], e = /\s+/, f = 0;f < d.len
gth;f++) { | |
2033 var g = "^\\s*" + d[f].trim().replace(e, "\\s*") + "s*[^a-z]$"; | |
2034 if ((new RegExp(g, "i")).test(a.textContent)) { | |
2035 return !0; | |
2036 } | |
2037 } | |
2038 c = c.stopwords || "click tap go here learn more this page link about".split("
"); | |
2039 d = axs.properties.findTextAlternatives(a, {}); | |
2040 if (null === d || "" === d.trim()) { | |
2041 return !0; | |
2042 } | |
2043 d = d.replace(/[^a-zA-Z ]/g, ""); | |
2044 for (f = 0;f < c.length;f++) { | |
2045 if (d = d.replace(new RegExp("\\b" + c[f] + "\\b", "ig"), ""), "" == d.trim(
)) { | |
2046 return !0; | |
2047 } | |
2048 } | |
2049 return !1; | |
2050 }, code:"AX_TEXT_04"}); | |
2051 axs.AuditRules.addRule({name:"lowContrastElements", heading:"Text elements shoul
d have a reasonable contrast ratio", url:"https://github.com/GoogleChrome/access
ibility-developer-tools/wiki/Audit-Rules#ax_color_01", severity:axs.constants.Se
verity.WARNING, relevantElementMatcher:function(a) { | |
2052 return axs.properties.hasDirectTextDescendant(a) && !axs.utils.isElementDisabl
ed(a); | |
2053 }, test:function(a) { | 1639 }, test:function(a) { |
2054 var b = window.getComputedStyle(a, null); | 1640 var b = window.getComputedStyle(a, null); |
2055 return (a = axs.utils.getContrastRatioForElementWithComputedStyle(b, a)) && ax
s.utils.isLowContrast(a, b); | 1641 return(a = axs.utils.getContrastRatioForElementWithComputedStyle(b, a)) && axs
.utils.isLowContrast(a, b); |
2056 }, code:"AX_COLOR_01"}); | 1642 }, code:"AX_COLOR_01"}; |
2057 axs.AuditRules.addRule({name:"mainRoleOnInappropriateElement", heading:"role=mai
n should only appear on significant elements", url:"https://github.com/GoogleChr
ome/accessibility-developer-tools/wiki/Audit-Rules#ax_aria_05", severity:axs.con
stants.Severity.WARNING, relevantElementMatcher:function(a) { | 1643 axs.AuditRule.specs.mainRoleOnInappropriateElement = {name:"mainRoleOnInappropri
ateElement", heading:"role=main should only appear on significant elements", url
:"", severity:axs.constants.Severity.WARNING, relevantElementMatcher:function(a)
{ |
2058 return axs.browserUtils.matchSelector(a, "[role~=main]"); | 1644 return axs.browserUtils.matchSelector(a, "[role~=main]"); |
2059 }, test:function(a) { | 1645 }, test:function(a) { |
2060 if (axs.utils.isInlineElement(a)) { | 1646 if (axs.utils.isInlineElement(a)) { |
2061 return !0; | 1647 return!0; |
2062 } | 1648 } |
2063 a = axs.properties.getTextFromDescendantContent(a); | 1649 a = axs.properties.getTextFromDescendantContent(a); |
2064 return !a || 50 > a.length ? !0 : !1; | 1650 return!a || 50 > a.length ? !0 : !1; |
2065 }, code:"AX_ARIA_05"}); | 1651 }, code:"AX_ARIA_04"}; |
2066 axs.AuditRules.addRule({name:"elementsWithMeaningfulBackgroundImage", severity:a
xs.constants.Severity.WARNING, relevantElementMatcher:function(a) { | 1652 axs.AuditRule.specs.elementsWithMeaningfulBackgroundImage = {name:"elementsWithM
eaningfulBackgroundImage", severity:axs.constants.Severity.WARNING, relevantElem
entMatcher:function(a) { |
2067 return !axs.utils.isElementOrAncestorHidden(a); | 1653 return!axs.utils.isElementOrAncestorHidden(a); |
2068 }, heading:"Meaningful images should not be used in element backgrounds", url:"h
ttps://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules#ax
_image_01", test:function(a) { | 1654 }, heading:"Meaningful images should not be used in element backgrounds", url:"h
ttps://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules#-a
x_image_01--meaningful-images-should-not-be-used-in-element-backgrounds", test:f
unction(a) { |
2069 if (a.textContent && 0 < a.textContent.length) { | 1655 if (a.textContent && 0 < a.textContent.length) { |
2070 return !1; | 1656 return!1; |
2071 } | 1657 } |
2072 a = window.getComputedStyle(a, null); | 1658 a = window.getComputedStyle(a, null); |
2073 var b = a.backgroundImage; | 1659 var b = a.backgroundImage; |
2074 if (!b || "undefined" === b || "none" === b || 0 != b.indexOf("url")) { | 1660 if (!b || "undefined" === b || "none" === b || 0 != b.indexOf("url")) { |
2075 return !1; | 1661 return!1; |
2076 } | 1662 } |
2077 b = parseInt(a.width, 10); | 1663 b = parseInt(a.width, 10); |
2078 a = parseInt(a.height, 10); | 1664 a = parseInt(a.height, 10); |
2079 return 150 > b && 150 > a; | 1665 return 150 > b && 150 > a; |
2080 }, code:"AX_IMAGE_01"}); | 1666 }, code:"AX_IMAGE_01"}; |
2081 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_0
7", severity:axs.constants.Severity.WARNING, relevantElementMatcher:function(a)
{ | 1667 axs.AuditRule.specs.nonExistentAriaLabelledbyElement = {name:"nonExistentAriaLab
elledbyElement", heading:"aria-labelledby attributes should refer to an element
which exists in the DOM", url:"https://github.com/GoogleChrome/accessibility-dev
eloper-tools/wiki/Audit-Rules#-ax_aria_02--aria-labelledby-attributes-should-ref
er-to-an-element-which-exists-in-the-dom", severity:axs.constants.Severity.WARNI
NG, relevantElementMatcher:function(a) { |
2082 return axs.browserUtils.matchSelector(a, "[aria-owns]"); | 1668 return axs.browserUtils.matchSelector(a, "[aria-labelledby]"); |
2083 }, test:function(a) { | 1669 }, test:function(a) { |
2084 return axs.utils.getIdReferents("aria-owns", a).some(function(a) { | 1670 a = a.getAttribute("aria-labelledby").split(/\s+/); |
2085 return 1 < axs.utils.getAriaIdReferrers(a, "aria-owns").length; | 1671 for (var b = 0;b < a.length;b++) { |
2086 }); | 1672 if (!document.getElementById(a[b])) { |
2087 }, code:"AX_ARIA_07"}); | 1673 return!0; |
2088 axs.AuditRules.addRule({name:"multipleLabelableElementsPerLabel", heading:"A lab
el element may not have labelable descendants other than its labeled control.",
url:"https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Ru
les#-ax_text_03--labels-should-only-contain-one-labelable-element", severity:axs
.constants.Severity.SEVERE, relevantElementMatcher:function(a) { | |
2089 return axs.browserUtils.matchSelector(a, "label"); | |
2090 }, test:function(a) { | |
2091 if (1 < a.querySelectorAll(axs.utils.LABELABLE_ELEMENTS_SELECTOR).length) { | |
2092 return !0; | |
2093 } | |
2094 }, code:"AX_TEXT_03"}); | |
2095 axs.AuditRules.addRule({name:"nonExistentAriaRelatedElement", heading:"ARIA attr
ibutes 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", severity:axs.constants.Severity.SEVERE, relevantEl
ementMatcher:function(a) { | |
2096 var b = axs.utils.getAriaPropertiesByValueType(["idref", "idref_list"]), b = a
xs.utils.getSelectorForAriaProperties(b); | |
2097 return axs.browserUtils.matchSelector(a, b); | |
2098 }, test:function(a) { | |
2099 for (var b = axs.utils.getAriaPropertiesByValueType(["idref", "idref_list"]),
b = axs.utils.getSelectorForAriaProperties(b).split(","), c = 0, d = b.length;c
< d;c++) { | |
2100 var e = b[c]; | |
2101 if (axs.browserUtils.matchSelector(a, e)) { | |
2102 var e = e.match(/aria-[^\]]+/)[0], f = a.getAttribute(e); | |
2103 if (!axs.utils.getAriaPropertyValue(e, f, a).valid) { | |
2104 return !0; | |
2105 } | |
2106 } | 1674 } |
2107 } | 1675 } |
2108 return !1; | 1676 return!1; |
2109 }, code:"AX_ARIA_02"}); | 1677 }, code:"AX_ARIA_02"}; |
2110 axs.AuditRules.addRule({name:"pageWithoutTitle", heading:"The web page should ha
ve a title that describes topic or purpose", url:"https://github.com/GoogleChrom
e/accessibility-developer-tools/wiki/Audit-Rules#ax_title_01", severity:axs.cons
tants.Severity.WARNING, relevantElementMatcher:function(a) { | 1678 axs.AuditRule.specs.pageWithoutTitle = {name:"pageWithoutTitle", heading:"The we
b page should have a title that describes topic or purpose", url:"", severity:ax
s.constants.Severity.WARNING, relevantElementMatcher:function(a) { |
2111 return "html" == a.tagName.toLowerCase(); | 1679 return "html" == a.tagName.toLowerCase(); |
2112 }, test:function(a) { | 1680 }, test:function(a) { |
2113 a = a.querySelector("head"); | 1681 a = a.querySelector("head"); |
2114 return a ? (a = a.querySelector("title")) ? !a.textContent : !0 : !0; | 1682 return a ? (a = a.querySelector("title")) ? !a.textContent : !0 : !0; |
2115 }, code:"AX_TITLE_01"}); | 1683 }, code:"AX_TITLE_01"}; |
2116 axs.AuditRules.addRule({name:"requiredAriaAttributeMissing", heading:"Elements w
ith ARIA roles must have all required attributes for that role", url:"https://gi
thub.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules#ax_aria_03"
, severity:axs.constants.Severity.SEVERE, relevantElementMatcher:function(a) { | 1684 axs.AuditRule.specs.requiredAriaAttributeMissing = {name:"requiredAriaAttributeM
issing", 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-at
tributes-for-that-role", severity:axs.constants.Severity.SEVERE, relevantElement
Matcher:function(a) { |
2117 return axs.browserUtils.matchSelector(a, "[role]"); | 1685 return axs.browserUtils.matchSelector(a, "[role]"); |
2118 }, test:function(a) { | 1686 }, test:function(a) { |
2119 var b = axs.utils.getRoles(a); | 1687 var b = axs.utils.getRoles(a); |
2120 if (!b.valid) { | 1688 if (!b.valid) { |
2121 return !1; | 1689 return!1; |
2122 } | 1690 } |
2123 for (var c = 0;c < b.roles.length;c++) { | 1691 for (var c = 0;c < b.roles.length;c++) { |
2124 var d = b.roles[c].details.requiredPropertiesSet, e; | 1692 var d = b.roles[c].details.requiredPropertiesSet, e; |
2125 for (e in d) { | 1693 for (e in d) { |
2126 if (d = e.replace(/^aria-/, ""), !("defaultValue" in axs.constants.ARIA_PR
OPERTIES[d] || a.hasAttribute(e)) && 0 > axs.properties.getNativelySupportedAttr
ibutes(a).indexOf(e)) { | 1694 if (d = e.replace(/^aria-/, ""), !("defaultValue" in axs.constants.ARIA_PR
OPERTIES[d] || a.hasAttribute(e))) { |
2127 return !0; | 1695 return!0; |
2128 } | 1696 } |
2129 } | 1697 } |
2130 } | 1698 } |
2131 }, code:"AX_ARIA_03"}); | 1699 }, code:"AX_ARIA_03"}; |
2132 (function() { | 1700 axs.AuditRule.specs.unfocusableElementsWithOnClick = {name:"unfocusableElementsW
ithOnClick", heading:"Elements with onclick handlers must be focusable", url:"ht
tps://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules#-ax
_focus_02--elements-with-onclick-handlers-must-be-focusable", severity:axs.const
ants.Severity.WARNING, opt_requiresConsoleAPI:!0, relevantElementMatcher:functio
n(a) { |
2133 function a(a) { | |
2134 a = axs.utils.getRoles(a); | |
2135 if (!a || !a.applied) { | |
2136 return []; | |
2137 } | |
2138 a = a.applied; | |
2139 return a.valid ? a.details.mustcontain || [] : []; | |
2140 } | |
2141 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_0
8", severity:axs.constants.Severity.SEVERE, relevantElementMatcher:function(b) { | |
2142 return axs.browserUtils.matchSelector(b, "[role]") ? 0 < a(b).length : !1; | |
2143 }, test:function(b) { | |
2144 if ("true" === b.getAttribute("aria-busy")) { | |
2145 return !1; | |
2146 } | |
2147 for (var c = a(b), d = c.length - 1;0 <= d;d--) { | |
2148 var e = axs.utils.findDescendantsWithRole(b, c[d]); | |
2149 if (e && e.length) { | |
2150 return !1; | |
2151 } | |
2152 } | |
2153 b = axs.utils.getIdReferents("aria-owns", b); | |
2154 for (d = b.length - 1;0 <= d;d--) { | |
2155 if ((e = axs.utils.getRoles(b[d], !0)) && e.applied) { | |
2156 for (var e = e.applied, f = c.length - 1;0 <= f;f--) { | |
2157 if (e.name === c[f]) { | |
2158 return !1; | |
2159 } | |
2160 } | |
2161 } | |
2162 } | |
2163 return !0; | |
2164 }, code:"AX_ARIA_08"}); | |
2165 })(); | |
2166 axs.AuditRules.addRule({name:"roleTooltipRequiresDescribedby", heading:"Elements
with role=tooltip should have a corresponding element with aria-describedby", u
rl:"https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rul
es#ax_aria_02", severity:axs.constants.Severity.SEVERE, relevantElementMatcher:f
unction(a) { | |
2167 return axs.browserUtils.matchSelector(a, "[role=tooltip]") && !axs.utils.isEle
mentOrAncestorHidden(a); | |
2168 }, test:function(a) { | |
2169 return 0 === axs.utils.getAriaIdReferrers(a, "aria-describedby").length; | |
2170 }, code:"AX_TOOLTIP_01"}); | |
2171 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", severity:axs.constants.Severity.
WARNING, relevantElementMatcher:function(a) { | |
2172 return axs.browserUtils.matchSelector(a, "[tabindex]"); | |
2173 }, test:function(a) { | |
2174 if (0 < a.tabIndex) { | |
2175 return !0; | |
2176 } | |
2177 }, code:"AX_FOCUS_03"}); | |
2178 (function() { | |
2179 axs.AuditRules.addRule({name:"tableHasAppropriateHeaders", heading:"Tables sho
uld have appropriate headers", url:"https://github.com/GoogleChrome/accessibilit
y-developer-tools/wiki/Audit-Rules#ax_table_01", severity:axs.constants.Severity
.SEVERE, relevantElementMatcher:function(a) { | |
2180 return axs.browserUtils.matchSelector(a, "table"); | |
2181 }, test:function(a) { | |
2182 if ("presentation" == a.getAttribute("role")) { | |
2183 return 0 != a.querySelectorAll("th").length; | |
2184 } | |
2185 a = a.querySelectorAll("tr"); | |
2186 var b; | |
2187 a: { | |
2188 b = a[0].children; | |
2189 for (var c = 0;c < b.length;c++) { | |
2190 if ("TH" != b[c].tagName) { | |
2191 b = !0; | |
2192 break a; | |
2193 } | |
2194 } | |
2195 b = !1; | |
2196 } | |
2197 if (b) { | |
2198 a: { | |
2199 for (b = 0;b < a.length;b++) { | |
2200 if ("TH" != a[b].children[0].tagName) { | |
2201 b = !0; | |
2202 break a; | |
2203 } | |
2204 } | |
2205 b = !1; | |
2206 } | |
2207 } | |
2208 if (b) { | |
2209 a: { | |
2210 b = a[0].children; | |
2211 for (c = 1;c < b.length;c++) { | |
2212 if ("TH" != b[c].tagName) { | |
2213 b = !0; | |
2214 break a; | |
2215 } | |
2216 } | |
2217 for (c = 1;c < a.length;c++) { | |
2218 if ("TH" != a[c].children[0].tagName) { | |
2219 b = !0; | |
2220 break a; | |
2221 } | |
2222 } | |
2223 b = !1; | |
2224 } | |
2225 } | |
2226 return b; | |
2227 }, code:"AX_TABLE_01"}); | |
2228 })(); | |
2229 (function() { | |
2230 axs.AuditRules.addRule({name:"uncontrolledTabpanel", heading:"A tabpanel shoul
d be related to a tab via aria-controls or aria-labelledby", url:"https://github
.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules#ax_aria_13", se
verity:axs.constants.Severity.WARNING, relevantElementMatcher:function(a) { | |
2231 return axs.browserUtils.matchSelector(a, '[role="tabpanel"]'); | |
2232 }, test:function(a) { | |
2233 var b; | |
2234 b = document.querySelectorAll('[role="tab"][aria-controls="' + a.id + '"]'); | |
2235 (b = a.id && 1 === b.length) || (a.hasAttribute("aria-labelledby") ? (a = do
cument.querySelectorAll("#" + a.getAttribute("aria-labelledby")), b = 1 === a.le
ngth && "tab" === a[0].getAttribute("role")) : b = !1); | |
2236 return !b; | |
2237 }, code:"AX_ARIA_13"}); | |
2238 })(); | |
2239 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", severity:axs.consta
nts.Severity.WARNING, opt_requiresConsoleAPI:!0, relevantElementMatcher:function
(a) { | |
2240 return a instanceof a.ownerDocument.defaultView.HTMLBodyElement || axs.utils.i
sElementOrAncestorHidden(a) ? !1 : "click" in getEventListeners(a) ? !0 : !1; | 1701 return a instanceof a.ownerDocument.defaultView.HTMLBodyElement || axs.utils.i
sElementOrAncestorHidden(a) ? !1 : "click" in getEventListeners(a) ? !0 : !1; |
2241 }, test:function(a) { | 1702 }, test:function(a) { |
2242 return !a.hasAttribute("tabindex") && !axs.utils.isElementImplicitlyFocusable(
a) && !a.disabled; | 1703 return!a.hasAttribute("tabindex") && !axs.utils.isElementImplicitlyFocusable(a
) && !a.disabled; |
2243 }, code:"AX_FOCUS_02"}); | 1704 }, code:"AX_FOCUS_02"}; |
2244 (function() { | 1705 axs.AuditRule.specs.videoWithoutCaptions = {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) { |
2245 var a = /^aria\-/, b = axs.utils.getSelectorForAriaProperties(axs.constants.AR
IA_PROPERTIES); | |
2246 axs.AuditRules.addRule({name:"unsupportedAriaAttribute", heading:"This element
has an unsupported ARIA attribute", url:"https://github.com/GoogleChrome/access
ibility-developer-tools/wiki/Audit-Rules#ax_aria_10", severity:axs.constants.Sev
erity.SEVERE, relevantElementMatcher:function(a) { | |
2247 return axs.browserUtils.matchSelector(a, b); | |
2248 }, test:function(b) { | |
2249 var d = axs.utils.getRoles(b, !0), d = d && d.applied ? d.applied.details.pr
opertiesSet : axs.constants.GLOBAL_PROPERTIES; | |
2250 b = b.attributes; | |
2251 for (var e = 0, f = b.length;e < f;e++) { | |
2252 var g = b[e].name; | |
2253 if (a.test(g)) { | |
2254 var h = g.replace(a, ""); | |
2255 if (axs.constants.ARIA_PROPERTIES.hasOwnProperty(h) && !(g in d)) { | |
2256 return !0; | |
2257 } | |
2258 } | |
2259 } | |
2260 return !1; | |
2261 }, code:"AX_ARIA_10"}); | |
2262 })(); | |
2263 axs.AuditRules.addRule({name:"videoWithoutCaptions", heading:"Video elements sho
uld use <track> elements to provide captions", url:"https://github.com/GoogleChr
ome/accessibility-developer-tools/wiki/Audit-Rules#ax_video_01", severity:axs.co
nstants.Severity.WARNING, relevantElementMatcher:function(a) { | |
2264 return axs.browserUtils.matchSelector(a, "video"); | 1706 return axs.browserUtils.matchSelector(a, "video"); |
2265 }, test:function(a) { | 1707 }, test:function(a) { |
2266 return !a.querySelectorAll("track[kind=captions]").length; | 1708 return!a.querySelectorAll("track[kind=captions]").length; |
2267 }, code:"AX_VIDEO_01"}); | 1709 }, code:"AX_VIDEO_01"}; |
2268 | 1710 |
2269 return axs; | |
2270 }); | |
2271 | 1711 |
2272 // Define AMD module if possible, export globals otherwise. | |
2273 if (typeof define !== 'undefined' && define.amd) { | |
2274 define([], fn); | |
2275 } else { | |
2276 var axs = fn.call(this); | |
2277 } | |
2278 | |
OLD | NEW |