OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2015 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/3d4893b4ecd0eb8f4765e04479213d04b240f3e0 | 16 * Generated from http://github.com/GoogleChrome/accessibility-developer-tools/t
ree/404ede0f2186682fbbef624141e76ec2b601317d |
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 COMPILED = !0, goog = goog || {}; | 23 var fn = (function() { |
| 24 var COMPILED = !0, goog = goog || {}; |
24 goog.global = this; | 25 goog.global = this; |
25 goog.isDef = function(a) { | 26 goog.isDef = function(a) { |
26 return void 0 !== a; | 27 return void 0 !== a; |
27 }; | 28 }; |
28 goog.exportPath_ = function(a, b, c) { | 29 goog.exportPath_ = function(a, b, c) { |
29 a = a.split("."); | 30 a = a.split("."); |
30 c = c || goog.global; | 31 c = c || goog.global; |
31 a[0] in c || !c.execScript || c.execScript("var " + a[0]); | 32 a[0] in c || !c.execScript || c.execScript("var " + a[0]); |
32 for (var d;a.length && (d = a.shift());) { | 33 for (var d;a.length && (d = a.shift());) { |
33 !a.length && goog.isDef(b) ? c[d] = b : c = c[d] ? c[d] : c[d] = {}; | 34 !a.length && goog.isDef(b) ? c[d] = b : c = c[d] ? c[d] : c[d] = {}; |
(...skipping 21 matching lines...) Expand all Loading... |
55 goog.exportPath_(a); | 56 goog.exportPath_(a); |
56 }; | 57 }; |
57 goog.setTestOnly = function(a) { | 58 goog.setTestOnly = function(a) { |
58 if (COMPILED && !goog.DEBUG) { | 59 if (COMPILED && !goog.DEBUG) { |
59 throw a = a || "", Error("Importing test-only code into non-debug environmen
t" + a ? ": " + a : "."); | 60 throw a = a || "", Error("Importing test-only code into non-debug environmen
t" + a ? ": " + a : "."); |
60 } | 61 } |
61 }; | 62 }; |
62 goog.forwardDeclare = function(a) { | 63 goog.forwardDeclare = function(a) { |
63 }; | 64 }; |
64 COMPILED || (goog.isProvided_ = function(a) { | 65 COMPILED || (goog.isProvided_ = function(a) { |
65 return!goog.implicitNamespaces_[a] && goog.isDefAndNotNull(goog.getObjectByNam
e(a)); | 66 return !goog.implicitNamespaces_[a] && goog.isDefAndNotNull(goog.getObjectByNa
me(a)); |
66 }, goog.implicitNamespaces_ = {}); | 67 }, goog.implicitNamespaces_ = {}); |
67 goog.getObjectByName = function(a, b) { | 68 goog.getObjectByName = function(a, b) { |
68 for (var c = a.split("."), d = b || goog.global, e;e = c.shift();) { | 69 for (var c = a.split("."), d = b || goog.global, e;e = c.shift();) { |
69 if (goog.isDefAndNotNull(d[e])) { | 70 if (goog.isDefAndNotNull(d[e])) { |
70 d = d[e]; | 71 d = d[e]; |
71 } else { | 72 } else { |
72 return null; | 73 return null; |
73 } | 74 } |
74 } | 75 } |
75 return d; | 76 return d; |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 } | 147 } |
147 } | 148 } |
148 }, goog.importScript_ = function(a) { | 149 }, goog.importScript_ = function(a) { |
149 var b = goog.global.CLOSURE_IMPORT_SCRIPT || goog.writeScriptTag_; | 150 var b = goog.global.CLOSURE_IMPORT_SCRIPT || goog.writeScriptTag_; |
150 !goog.dependencies_.written[a] && b(a) && (goog.dependencies_.written[a] = !0)
; | 151 !goog.dependencies_.written[a] && b(a) && (goog.dependencies_.written[a] = !0)
; |
151 }, goog.writeScriptTag_ = function(a) { | 152 }, goog.writeScriptTag_ = function(a) { |
152 if (goog.inHtmlDocument_()) { | 153 if (goog.inHtmlDocument_()) { |
153 var b = goog.global.document; | 154 var b = goog.global.document; |
154 if ("complete" == b.readyState) { | 155 if ("complete" == b.readyState) { |
155 if (/\bdeps.js$/.test(a)) { | 156 if (/\bdeps.js$/.test(a)) { |
156 return!1; | 157 return !1; |
157 } | 158 } |
158 throw Error('Cannot write "' + a + '" after document load'); | 159 throw Error('Cannot write "' + a + '" after document load'); |
159 } | 160 } |
160 b.write('<script type="text/javascript" src="' + a + '">\x3c/script>'); | 161 b.write('<script type="text/javascript" src="' + a + '">\x3c/script>'); |
161 return!0; | 162 return !0; |
162 } | 163 } |
163 return!1; | 164 return !1; |
164 }, goog.writeScripts_ = function() { | 165 }, goog.writeScripts_ = function() { |
165 function a(e) { | 166 function a(e) { |
166 if (!(e in d.written)) { | 167 if (!(e in d.written)) { |
167 if (!(e in d.visited) && (d.visited[e] = !0, e in d.requires)) { | 168 if (!(e in d.visited) && (d.visited[e] = !0, e in d.requires)) { |
168 for (var g in d.requires[e]) { | 169 for (var g in d.requires[e]) { |
169 if (!goog.isProvided_(g)) { | 170 if (!goog.isProvided_(g)) { |
170 if (g in d.nameToPath) { | 171 if (g in d.nameToPath) { |
171 a(d.nameToPath[g]); | 172 a(d.nameToPath[g]); |
172 } else { | 173 } else { |
173 throw Error("Undefined nameToPath for " + g); | 174 throw Error("Undefined nameToPath for " + g); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 return "function" == goog.typeOf(a); | 252 return "function" == goog.typeOf(a); |
252 }; | 253 }; |
253 goog.isObject = function(a) { | 254 goog.isObject = function(a) { |
254 var b = typeof a; | 255 var b = typeof a; |
255 return "object" == b && null != a || "function" == b; | 256 return "object" == b && null != a || "function" == b; |
256 }; | 257 }; |
257 goog.getUid = function(a) { | 258 goog.getUid = function(a) { |
258 return a[goog.UID_PROPERTY_] || (a[goog.UID_PROPERTY_] = ++goog.uidCounter_); | 259 return a[goog.UID_PROPERTY_] || (a[goog.UID_PROPERTY_] = ++goog.uidCounter_); |
259 }; | 260 }; |
260 goog.hasUid = function(a) { | 261 goog.hasUid = function(a) { |
261 return!!a[goog.UID_PROPERTY_]; | 262 return !!a[goog.UID_PROPERTY_]; |
262 }; | 263 }; |
263 goog.removeUid = function(a) { | 264 goog.removeUid = function(a) { |
264 "removeAttribute" in a && a.removeAttribute(goog.UID_PROPERTY_); | 265 "removeAttribute" in a && a.removeAttribute(goog.UID_PROPERTY_); |
265 try { | 266 try { |
266 delete a[goog.UID_PROPERTY_]; | 267 delete a[goog.UID_PROPERTY_]; |
267 } catch (b) { | 268 } catch (b) { |
268 } | 269 } |
269 }; | 270 }; |
270 goog.UID_PROPERTY_ = "closure_uid_" + (1E9 * Math.random() >>> 0); | 271 goog.UID_PROPERTY_ = "closure_uid_" + (1E9 * Math.random() >>> 0); |
271 goog.uidCounter_ = 0; | 272 goog.uidCounter_ = 0; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 b.push.apply(b, arguments); | 316 b.push.apply(b, arguments); |
316 return a.apply(this, b); | 317 return a.apply(this, b); |
317 }; | 318 }; |
318 }; | 319 }; |
319 goog.mixin = function(a, b) { | 320 goog.mixin = function(a, b) { |
320 for (var c in b) { | 321 for (var c in b) { |
321 a[c] = b[c]; | 322 a[c] = b[c]; |
322 } | 323 } |
323 }; | 324 }; |
324 goog.now = goog.TRUSTED_SITE && Date.now || function() { | 325 goog.now = goog.TRUSTED_SITE && Date.now || function() { |
325 return+new Date; | 326 return +new Date; |
326 }; | 327 }; |
327 goog.globalEval = function(a) { | 328 goog.globalEval = function(a) { |
328 if (goog.global.execScript) { | 329 if (goog.global.execScript) { |
329 goog.global.execScript(a, "JavaScript"); | 330 goog.global.execScript(a, "JavaScript"); |
330 } else { | 331 } else { |
331 if (goog.global.eval) { | 332 if (goog.global.eval) { |
332 if (null == goog.evalWorksForGlobals_ && (goog.global.eval("var _et_ = 1;"
), "undefined" != typeof goog.global._et_ ? (delete goog.global._et_, goog.evalW
orksForGlobals_ = !0) : goog.evalWorksForGlobals_ = !1), goog.evalWorksForGlobal
s_) { | 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_) { |
333 goog.global.eval(a); | 334 goog.global.eval(a); |
334 } else { | 335 } else { |
335 var b = goog.global.document, c = b.createElement("script"); | 336 var b = goog.global.document, c = b.createElement("script"); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 return a.constructor.prototype[b].apply(a, e); | 415 return a.constructor.prototype[b].apply(a, e); |
415 } | 416 } |
416 throw Error("goog.base called from a method of one name to a method of a diffe
rent name"); | 417 throw Error("goog.base called from a method of one name to a method of a diffe
rent name"); |
417 }; | 418 }; |
418 goog.scope = function(a) { | 419 goog.scope = function(a) { |
419 a.call(goog.global); | 420 a.call(goog.global); |
420 }; | 421 }; |
421 var axs = {}; | 422 var axs = {}; |
422 axs.browserUtils = {}; | 423 axs.browserUtils = {}; |
423 axs.browserUtils.matchSelector = function(a, b) { | 424 axs.browserUtils.matchSelector = function(a, b) { |
424 return a.webkitMatchesSelector ? a.webkitMatchesSelector(b) : a.mozMatchesSele
ctor ? a.mozMatchesSelector(b) : !1; | 425 return a.matches ? a.matches(b) : a.webkitMatchesSelector ? a.webkitMatchesSel
ector(b) : a.mozMatchesSelector ? a.mozMatchesSelector(b) : a.msMatchesSelector
? a.msMatchesSelector(b) : !1; |
425 }; | 426 }; |
426 axs.constants = {}; | 427 axs.constants = {}; |
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", | 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", |
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"], | 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"], |
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"], | 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"], |
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"]}, | 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"]}, |
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"]}, | 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"]}, |
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"], | 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"], |
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"], | 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, |
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"], | 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, |
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(" ")}, | 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(" ")}, |
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"], | 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"]}, |
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", | 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, |
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", | 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"], |
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"], | 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"]}, |
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"], | 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"], |
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"]}}; | 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"]}}; |
442 axs.constants.WIDGET_ROLES = {}; | 443 axs.constants.WIDGET_ROLES = {}; |
443 axs.constants.addAllParentRolesToSet_ = function(a, b) { | 444 axs.constants.addAllParentRolesToSet_ = function(a, b) { |
444 if (a.parent) { | 445 if (a.parent) { |
445 for (var c = a.parent, d = 0;d < c.length;d++) { | 446 for (var c = a.parent, d = 0;d < c.length;d++) { |
446 var e = c[d]; | 447 var e = c[d]; |
447 b[e] = !0; | 448 b[e] = !0; |
448 axs.constants.addAllParentRolesToSet_(axs.constants.ARIA_ROLES[e], b); | 449 axs.constants.addAllParentRolesToSet_(axs.constants.ARIA_ROLES[e], b); |
449 } | 450 } |
450 } | 451 } |
451 }; | 452 }; |
(...skipping 21 matching lines...) Expand all Loading... |
473 axs.constants.addAllParentRolesToSet_(role, parentRolesSet); | 474 axs.constants.addAllParentRolesToSet_(role, parentRolesSet); |
474 role.allParentRolesSet = parentRolesSet; | 475 role.allParentRolesSet = parentRolesSet; |
475 "widget" in parentRolesSet && (axs.constants.WIDGET_ROLES[roleName] = role); | 476 "widget" in parentRolesSet && (axs.constants.WIDGET_ROLES[roleName] = role); |
476 } | 477 } |
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"}, | 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"}, |
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", | 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", |
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"]}, | 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"]}, |
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", | 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", |
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", | 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", |
482 "other"]}, valuemax:{type:"property", valueType:"decimal"}, valuemin:{type:"prop
erty", valueType:"decimal"}, valuenow:{type:"property", valueType:"decimal"}, va
luetext:{type:"property", valueType:"string"}}; | 483 "other"]}, valuemax:{type:"property", valueType:"decimal"}, valuemin:{type:"prop
erty", valueType:"decimal"}, valuenow:{type:"property", valueType:"decimal"}, va
luetext:{type:"property", valueType:"string"}}; |
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(" "); | 484 (function() { |
| 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; |
484 axs.constants.NO_ROLE_NAME = " "; | 496 axs.constants.NO_ROLE_NAME = " "; |
485 axs.constants.WIDGET_ROLE_TO_NAME = {alert:"aria_role_alert", alertdialog:"aria_
role_alertdialog", button:"aria_role_button", checkbox:"aria_role_checkbox", 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", | 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", |
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"}; | 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"}; |
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", | 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", |
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"}; | 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"}; |
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", | 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", |
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", | 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", |
491 "false":"aria_selected_false"}}]; | 503 "false":"aria_selected_false"}}]; |
492 axs.constants.INPUT_TYPE_TO_INFORMATION_TABLE_MSG = {button:"input_type_button",
checkbox:"input_type_checkbox", color:"input_type_color", datetime:"input_type_
datetime", "datetime-local":"input_type_datetime_local", date:"input_type_date",
email:"input_type_email", file:"input_type_file", image:"input_type_image", 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", | 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", |
493 submit:"input_type_submit", tel:"input_type_tel", text:"input_type_text", url:"i
nput_type_url", week:"input_type_week"}; | 505 submit:"input_type_submit", tel:"input_type_tel", text:"input_type_text", url:"i
nput_type_url", week:"input_type_week"}; |
494 axs.constants.TAG_TO_INFORMATION_TABLE_VERBOSE_MSG = {A:"tag_link", BUTTON:"tag_
button", H1:"tag_h1", H2:"tag_h2", H3:"tag_h3", H4:"tag_h4", H5:"tag_h5", H6:"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"}; | 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"}; |
495 axs.constants.TAG_TO_INFORMATION_TABLE_BRIEF_MSG = {BUTTON:"tag_button", SELECT:
"tag_select", TEXTAREA:"tag_textarea"}; | 507 axs.constants.TAG_TO_INFORMATION_TABLE_BRIEF_MSG = {BUTTON:"tag_button", SELECT:
"tag_select", TEXTAREA:"tag_textarea"}; |
496 axs.constants.MIXED_VALUES = {"true":!0, "false":!0, mixed:!0}; | 508 axs.constants.MIXED_VALUES = {"true":!0, "false":!0, mixed:!0}; |
497 (function() { | |
498 for (var a in axs.constants.ARIA_PROPERTIES) { | |
499 var b = axs.constants.ARIA_PROPERTIES[a]; | |
500 if (b.values) { | |
501 for (var c = {}, d = 0;d < b.values.length;d++) { | |
502 c[b.values[d]] = !0; | |
503 } | |
504 b.valuesSet = c; | |
505 } | |
506 } | |
507 })(); | |
508 axs.constants.Severity = {INFO:"Info", WARNING:"Warning", SEVERE:"Severe"}; | 509 axs.constants.Severity = {INFO:"Info", WARNING:"Warning", SEVERE:"Severe"}; |
509 axs.constants.AuditResult = {PASS:"PASS", FAIL:"FAIL", NA:"NA"}; | 510 axs.constants.AuditResult = {PASS:"PASS", FAIL:"FAIL", NA:"NA"}; |
510 axs.constants.InlineElements = {TT:!0, I:!0, B:!0, BIG:!0, SMALL:!0, EM:!0, 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}; | 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}; |
511 axs.utils = {}; | 512 axs.constants.NATIVELY_DISABLEABLE = {BUTTON:!0, INPUT:!0, SELECT:!0, TEXTAREA:!
0, FIELDSET:!0, OPTGROUP:!0, OPTION:!0}; |
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]"; | 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"}; |
513 axs.utils.Color = function(a, b, c, d) { | 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", |
| 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) { |
514 this.red = a; | 530 this.red = a; |
515 this.green = b; | 531 this.green = b; |
516 this.blue = c; | 532 this.blue = c; |
517 this.alpha = d; | 533 this.alpha = d; |
518 }; | 534 }; |
519 axs.utils.calculateContrastRatio = function(a, b) { | 535 axs.color.YCbCr = function(a) { |
520 if (!a || !b) { | 536 this.luma = this.z = a[0]; |
521 return null; | 537 this.Cb = this.x = a[1]; |
522 } | 538 this.Cr = this.y = a[2]; |
523 1 > a.alpha && (a = axs.utils.flattenColors(a, b)); | 539 }; |
524 var c = axs.utils.calculateLuminance(a), d = axs.utils.calculateLuminance(b); | 540 axs.color.YCbCr.prototype = {multiply:function(a) { |
525 return(Math.max(c, d) + .05) / (Math.min(c, d) + .05); | 541 return new axs.color.YCbCr([this.luma * a, this.Cb * a, this.Cr * a]); |
526 }; | 542 }, add:function(a) { |
527 axs.utils.luminanceRatio = function(a, b) { | 543 return new axs.color.YCbCr([this.luma + a.luma, this.Cb + a.Cb, this.Cr + a.Cr
]); |
528 return(Math.max(a, b) + .05) / (Math.min(a, b) + .05); | 544 }, subtract:function(a) { |
529 }; | 545 return new axs.color.YCbCr([this.luma - a.luma, this.Cb - a.Cb, this.Cr - a.Cr
]); |
530 axs.utils.parentElement = function(a) { | 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 }; |
| 552 axs.color.calculateLuminance = 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) { |
531 if (!a) { | 691 if (!a) { |
532 return null; | 692 return null; |
533 } | 693 } |
534 if (a.nodeType == Node.DOCUMENT_FRAGMENT_NODE) { | 694 a = axs.dom.composedParentNode(a); |
535 return a.host; | |
536 } | |
537 var b = a.parentElement; | |
538 if (b) { | |
539 return b; | |
540 } | |
541 a = a.parentNode; | |
542 if (!a) { | 695 if (!a) { |
543 return null; | 696 return null; |
544 } | 697 } |
545 switch(a.nodeType) { | 698 switch(a.nodeType) { |
546 case Node.ELEMENT_NODE: | 699 case Node.ELEMENT_NODE: |
547 return a; | 700 return a; |
| 701 default: |
| 702 return axs.dom.parentElement(a); |
| 703 } |
| 704 }; |
| 705 axs.dom.shadowHost = 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) { |
| 730 case Node.COMMENT_NODE: |
| 731 break; |
| 732 case Node.ELEMENT_NODE: |
| 733 if ("script" == a.localName || "template" == a.localName) { |
| 734 break; |
| 735 } |
| 736 return a; |
548 case Node.DOCUMENT_FRAGMENT_NODE: | 737 case Node.DOCUMENT_FRAGMENT_NODE: |
549 return a.host; | 738 return a.host; |
| 739 case Node.TEXT_NODE: |
| 740 return axs.dom.parentElement(a); |
550 default: | 741 default: |
551 return null; | 742 console.warn("Unhandled node type: ", a.nodeType); |
552 } | 743 } |
553 }; | 744 return null; |
554 axs.utils.asElement = function(a) { | 745 }; |
555 switch(a.nodeType) { | 746 axs.dom.composedTreeSearch = function(a, b, c, d) { |
556 case Node.COMMENT_NODE: | 747 if (a === b) { |
557 return null; | 748 return !0; |
558 case Node.ELEMENT_NODE: | 749 } |
559 if ("script" == a.tagName.toLowerCase()) { | 750 if (a.nodeType == Node.ELEMENT_NODE) { |
560 return null; | 751 var e = a |
561 } | 752 } |
562 break; | 753 var f = !1; |
563 case Node.TEXT_NODE: | 754 if (e && c.preorder && !c.preorder(e)) { |
564 a = axs.utils.parentElement(a); | 755 return f; |
565 break; | 756 } |
566 default: | 757 if (e) { |
567 return console.warn("Unhandled node type: ", a.nodeType), null; | 758 var g = e.shadowRoot || e.webkitShadowRoot; |
568 } | 759 if (g) { |
569 return a; | 760 return f = axs.dom.composedTreeSearch(g, b, c, g), e && c.postorder && !f
&& c.postorder(e), f; |
570 }; | 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"; |
571 axs.utils.elementIsTransparent = function(a) { | 780 axs.utils.elementIsTransparent = function(a) { |
572 return "0" == a.style.opacity; | 781 return "0" == a.style.opacity; |
573 }; | 782 }; |
574 axs.utils.elementHasZeroArea = function(a) { | 783 axs.utils.elementHasZeroArea = function(a) { |
575 a = a.getBoundingClientRect(); | 784 a = a.getBoundingClientRect(); |
576 var b = a.top - a.bottom; | 785 var b = a.top - a.bottom; |
577 return a.right - a.left && b ? !1 : !0; | 786 return a.right - a.left && b ? !1 : !0; |
578 }; | 787 }; |
579 axs.utils.elementIsOutsideScrollArea = function(a) { | 788 axs.utils.elementIsOutsideScrollArea = function(a) { |
580 for (var b = axs.utils.parentElement(a), c = a.ownerDocument.defaultView;b !=
c.document.body;) { | 789 for (var b = axs.dom.parentElement(a), c = a.ownerDocument.defaultView;b != c.
document.body;) { |
581 if (axs.utils.isClippedBy(a, b)) { | 790 if (axs.utils.isClippedBy(a, b)) { |
582 return!0; | 791 return !0; |
583 } | 792 } |
584 if (axs.utils.canScrollTo(a, b) && !axs.utils.elementIsOutsideScrollArea(b))
{ | 793 if (axs.utils.canScrollTo(a, b) && !axs.utils.elementIsOutsideScrollArea(b))
{ |
585 return!1; | 794 return !1; |
586 } | 795 } |
587 b = axs.utils.parentElement(b); | 796 b = axs.dom.parentElement(b); |
588 } | 797 } |
589 return!axs.utils.canScrollTo(a, c.document.body); | 798 return !axs.utils.canScrollTo(a, c.document.body); |
590 }; | 799 }; |
591 axs.utils.canScrollTo = function(a, b) { | 800 axs.utils.canScrollTo = function(a, b) { |
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; | 801 var c = a.getBoundingClientRect(), d = b.getBoundingClientRect(); |
593 if (c.right < f - b.scrollLeft || c.bottom < g || c.left > h || c.top > e) { | 802 if (b == b.ownerDocument.body) { |
594 return!1; | 803 var e = d.top, f = d.left |
| 804 } else { |
| 805 e = d.top - b.scrollTop, f = d.left - b.scrollLeft; |
595 } | 806 } |
596 f = a.ownerDocument.defaultView; | 807 var g = e + b.scrollHeight, h = f + b.scrollWidth; |
597 g = f.getComputedStyle(b); | 808 if (c.right < f || c.bottom < e || c.left > h || c.top > g) { |
598 return c.left > d.right || c.top > d.bottom ? "scroll" == g.overflow || "auto"
== g.overflow || b instanceof f.HTMLBodyElement : !0; | 809 return !1; |
| 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; |
599 }; | 814 }; |
600 axs.utils.isClippedBy = function(a, b) { | 815 axs.utils.isClippedBy = function(a, 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); | 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); |
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; | 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; |
603 }; | 818 }; |
604 axs.utils.isAncestor = function(a, b) { | 819 axs.utils.isAncestor = function(a, b) { |
605 return null == b ? !1 : b === a ? !0 : axs.utils.isAncestor(a, b.parentNode); | 820 if (null == b) { |
| 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); |
606 }; | 828 }; |
607 axs.utils.overlappingElements = function(a) { | 829 axs.utils.overlappingElements = function(a) { |
608 if (axs.utils.elementHasZeroArea(a)) { | 830 if (axs.utils.elementHasZeroArea(a)) { |
609 return null; | 831 return null; |
610 } | 832 } |
611 for (var b = [], c = a.getClientRects(), d = 0;d < c.length;d++) { | 833 for (var b = [], c = a.getClientRects(), d = 0;d < c.length;d++) { |
612 var e = c[d], e = document.elementFromPoint((e.left + e.right) / 2, (e.top +
e.bottom) / 2); | 834 var e = c[d], e = document.elementFromPoint((e.left + e.right) / 2, (e.top +
e.bottom) / 2); |
613 if (null != e && e != a && !axs.utils.isAncestor(e, a) && !axs.utils.isAnces
tor(a, e)) { | 835 if (null != e && e != a && !axs.utils.isAncestor(e, a) && !axs.utils.isAnces
tor(a, e)) { |
614 var f = window.getComputedStyle(e, null); | 836 var f = window.getComputedStyle(e, null); |
615 f && (f = axs.utils.getBgColor(f, e)) && 0 < f.alpha && 0 > b.indexOf(e) &
& b.push(e); | 837 f && (f = axs.utils.getBgColor(f, e)) && 0 < f.alpha && 0 > b.indexOf(e) &
& b.push(e); |
(...skipping 25 matching lines...) Expand all Loading... |
641 return a && b >= c || b >= d; | 863 return a && b >= c || b >= d; |
642 } | 864 } |
643 if (c = b.match(/(\d+)em/)) { | 865 if (c = b.match(/(\d+)em/)) { |
644 return b = parseInt(c[1], 10), a && 1.2 <= b || 1.5 <= b ? !0 : !1; | 866 return b = parseInt(c[1], 10), a && 1.2 <= b || 1.5 <= b ? !0 : !1; |
645 } | 867 } |
646 if (c = b.match(/(\d+)%/)) { | 868 if (c = b.match(/(\d+)%/)) { |
647 return b = parseInt(c[1], 10), a && 120 <= b || 150 <= b ? !0 : !1; | 869 return b = parseInt(c[1], 10), a && 120 <= b || 150 <= b ? !0 : !1; |
648 } | 870 } |
649 if (c = b.match(/(\d+)pt/)) { | 871 if (c = b.match(/(\d+)pt/)) { |
650 if (b = parseInt(c[1], 10), a && 14 <= b || 18 <= b) { | 872 if (b = parseInt(c[1], 10), a && 14 <= b || 18 <= b) { |
651 return!0; | 873 return !0; |
652 } | 874 } |
653 } | 875 } |
654 return!1; | 876 return !1; |
655 }; | 877 }; |
656 axs.utils.getBgColor = function(a, b) { | 878 axs.utils.getBgColor = function(a, b) { |
657 var c = axs.utils.parseColor(a.backgroundColor); | 879 var c = axs.color.parseColor(a.backgroundColor); |
658 if (!c) { | 880 if (!c) { |
659 return null; | 881 return null; |
660 } | 882 } |
661 1 > a.opacity && (c.alpha *= a.opacity); | 883 1 > a.opacity && (c.alpha *= a.opacity); |
662 if (1 > c.alpha) { | 884 if (1 > c.alpha) { |
663 var d = axs.utils.getParentBgColor(b); | 885 var d = axs.utils.getParentBgColor(b); |
664 if (null == d) { | 886 if (null == d) { |
665 return null; | 887 return null; |
666 } | 888 } |
667 c = axs.utils.flattenColors(c, d); | 889 c = axs.color.flattenColors(c, d); |
668 } | 890 } |
669 return c; | 891 return c; |
670 }; | 892 }; |
671 axs.utils.getParentBgColor = function(a) { | 893 axs.utils.getParentBgColor = function(a) { |
672 var b = a; | 894 var b = a; |
673 a = []; | 895 a = []; |
674 for (var c = null;b = axs.utils.parentElement(b);) { | 896 for (var c = null;b = axs.dom.parentElement(b);) { |
675 var d = window.getComputedStyle(b, null); | 897 var d = window.getComputedStyle(b, null); |
676 if (d) { | 898 if (d) { |
677 var e = axs.utils.parseColor(d.backgroundColor); | 899 var e = axs.color.parseColor(d.backgroundColor); |
678 if (e && (1 > d.opacity && (e.alpha *= d.opacity), 0 != e.alpha && (a.push
(e), 1 == e.alpha))) { | 900 if (e && (1 > d.opacity && (e.alpha *= d.opacity), 0 != e.alpha && (a.push
(e), 1 == e.alpha))) { |
679 c = !0; | 901 c = !0; |
680 break; | 902 break; |
681 } | 903 } |
682 } | 904 } |
683 } | 905 } |
684 c || a.push(new axs.utils.Color(255, 255, 255, 1)); | 906 c || a.push(new axs.color.Color(255, 255, 255, 1)); |
685 for (b = a.pop();a.length;) { | 907 for (b = a.pop();a.length;) { |
686 c = a.pop(), b = axs.utils.flattenColors(c, b); | 908 c = a.pop(), b = axs.color.flattenColors(c, b); |
687 } | 909 } |
688 return b; | 910 return b; |
689 }; | 911 }; |
690 axs.utils.getFgColor = function(a, b, c) { | 912 axs.utils.getFgColor = function(a, b, c) { |
691 var d = axs.utils.parseColor(a.color); | 913 var d = axs.color.parseColor(a.color); |
692 if (!d) { | 914 if (!d) { |
693 return null; | 915 return null; |
694 } | 916 } |
695 1 > d.alpha && (d = axs.utils.flattenColors(d, c)); | 917 1 > d.alpha && (d = axs.color.flattenColors(d, c)); |
696 1 > a.opacity && (b = axs.utils.getParentBgColor(b), d.alpha *= a.opacity, d =
axs.utils.flattenColors(d, b)); | 918 1 > a.opacity && (b = axs.utils.getParentBgColor(b), d.alpha *= a.opacity, d =
axs.color.flattenColors(d, b)); |
697 return d; | 919 return d; |
698 }; | 920 }; |
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 }; | |
819 axs.utils.getContrastRatioForElement = function(a) { | 921 axs.utils.getContrastRatioForElement = function(a) { |
820 var b = window.getComputedStyle(a, null); | 922 var b = window.getComputedStyle(a, null); |
821 return axs.utils.getContrastRatioForElementWithComputedStyle(b, a); | 923 return axs.utils.getContrastRatioForElementWithComputedStyle(b, a); |
822 }; | 924 }; |
823 axs.utils.getContrastRatioForElementWithComputedStyle = function(a, b) { | 925 axs.utils.getContrastRatioForElementWithComputedStyle = function(a, b) { |
824 if (axs.utils.isElementHidden(b)) { | 926 if (axs.utils.isElementHidden(b)) { |
825 return null; | 927 return null; |
826 } | 928 } |
827 var c = axs.utils.getBgColor(a, b); | 929 var c = axs.utils.getBgColor(a, b); |
828 if (!c) { | 930 if (!c) { |
829 return null; | 931 return null; |
830 } | 932 } |
831 var d = axs.utils.getFgColor(a, b, c); | 933 var d = axs.utils.getFgColor(a, b, c); |
832 return d ? axs.utils.calculateContrastRatio(d, c) : null; | 934 return d ? axs.color.calculateContrastRatio(d, c) : null; |
833 }; | 935 }; |
834 axs.utils.isNativeTextElement = function(a) { | 936 axs.utils.isNativeTextElement = function(a) { |
835 var b = a.tagName.toLowerCase(); | 937 var b = a.tagName.toLowerCase(); |
836 a = a.type ? a.type.toLowerCase() : ""; | 938 a = a.type ? a.type.toLowerCase() : ""; |
837 if ("textarea" == b) { | 939 if ("textarea" == b) { |
838 return!0; | 940 return !0; |
839 } | 941 } |
840 if ("input" != b) { | 942 if ("input" != b) { |
841 return!1; | 943 return !1; |
842 } | 944 } |
843 switch(a) { | 945 switch(a) { |
844 case "email": | 946 case "email": |
845 ; | 947 ; |
846 case "number": | 948 case "number": |
847 ; | 949 ; |
848 case "password": | 950 case "password": |
849 ; | 951 ; |
850 case "search": | 952 case "search": |
851 ; | 953 ; |
852 case "text": | 954 case "text": |
853 ; | 955 ; |
854 case "tel": | 956 case "tel": |
855 ; | 957 ; |
856 case "url": | 958 case "url": |
857 ; | 959 ; |
858 case "": | 960 case "": |
859 return!0; | 961 return !0; |
860 default: | 962 default: |
861 return!1; | 963 return !1; |
862 } | 964 } |
863 }; | 965 }; |
864 axs.utils.isLowContrast = function(a, b, c) { | 966 axs.utils.isLowContrast = function(a, b, c) { |
865 a = Math.round(10 * a) / 10; | 967 a = Math.round(10 * a) / 10; |
866 return c ? 4.5 > a || !axs.utils.isLargeFont(b) && 7 > a : 3 > a || !axs.utils
.isLargeFont(b) && 4.5 > a; | 968 return c ? 4.5 > a || !axs.utils.isLargeFont(b) && 7 > a : 3 > a || !axs.utils
.isLargeFont(b) && 4.5 > a; |
867 }; | 969 }; |
868 axs.utils.hasLabel = function(a) { | 970 axs.utils.hasLabel = function(a) { |
869 var b = a.tagName.toLowerCase(), c = a.type ? a.type.toLowerCase() : ""; | 971 var b = a.tagName.toLowerCase(), c = a.type ? a.type.toLowerCase() : ""; |
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) { | 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) { |
871 return!0; | 973 return !0; |
872 } | 974 } |
873 for (b = axs.utils.parentElement(a);b;) { | 975 for (b = axs.dom.parentElement(a);b;) { |
874 if ("label" == b.tagName.toLowerCase() && b.control == a) { | 976 if ("label" == b.tagName.toLowerCase() && b.control == a) { |
875 return!0; | 977 return !0; |
876 } | 978 } |
877 b = axs.utils.parentElement(b); | 979 b = axs.dom.parentElement(b); |
878 } | 980 } |
879 return!1; | 981 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; |
880 }; | 999 }; |
881 axs.utils.isElementHidden = function(a) { | 1000 axs.utils.isElementHidden = function(a) { |
882 if (!(a instanceof a.ownerDocument.defaultView.HTMLElement)) { | 1001 if (!(a instanceof a.ownerDocument.defaultView.HTMLElement)) { |
883 return!1; | 1002 return !1; |
884 } | 1003 } |
885 if (a.hasAttribute("chromevoxignoreariahidden")) { | 1004 if (a.hasAttribute("chromevoxignoreariahidden")) { |
886 var b = !0 | 1005 var b = !0 |
887 } | 1006 } |
888 var c = window.getComputedStyle(a, null); | 1007 var c = window.getComputedStyle(a, null); |
889 return "none" == c.display || "hidden" == c.visibility ? !0 : a.hasAttribute("
aria-hidden") && "true" == a.getAttribute("aria-hidden").toLowerCase() ? !b : !1
; | 1008 return "none" == c.display || "hidden" == c.visibility ? !0 : a.hasAttribute("
aria-hidden") && "true" == a.getAttribute("aria-hidden").toLowerCase() ? !b : !1
; |
890 }; | 1009 }; |
891 axs.utils.isElementOrAncestorHidden = function(a) { | 1010 axs.utils.isElementOrAncestorHidden = function(a) { |
892 return axs.utils.isElementHidden(a) ? !0 : axs.utils.parentElement(a) ? axs.ut
ils.isElementOrAncestorHidden(axs.utils.parentElement(a)) : !1; | 1011 return axs.utils.isElementHidden(a) ? !0 : axs.dom.parentElement(a) ? axs.util
s.isElementOrAncestorHidden(axs.dom.parentElement(a)) : !1; |
893 }; | 1012 }; |
894 axs.utils.isInlineElement = function(a) { | 1013 axs.utils.isInlineElement = function(a) { |
895 a = a.tagName.toUpperCase(); | 1014 a = a.tagName.toUpperCase(); |
896 return axs.constants.InlineElements[a]; | 1015 return axs.constants.InlineElements[a]; |
897 }; | 1016 }; |
898 axs.utils.getRoles = function(a) { | 1017 axs.utils.getRoles = function(a, b) { |
899 if (!a.hasAttribute("role")) { | 1018 if (!a || a.nodeType !== Node.ELEMENT_NODE || !a.hasAttribute("role") && !b) { |
900 return!1; | 1019 return null; |
901 } | 1020 } |
902 a = a.getAttribute("role").split(" "); | 1021 var c = a.getAttribute("role"); |
903 for (var b = [], c = !0, d = 0;d < a.length;d++) { | 1022 !c && b && (c = axs.properties.getImplicitRole(a)); |
904 var e = a[d]; | 1023 if (!c) { |
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); | 1024 return null; |
906 } | 1025 } |
907 return{roles:b, valid:c}; | 1026 for (var c = c.split(" "), d = {roles:[], valid:!1}, e = 0;e < c.length;e++) { |
| 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; |
908 }; | 1032 }; |
909 axs.utils.getAriaPropertyValue = function(a, b, c) { | 1033 axs.utils.getAriaPropertyValue = function(a, b, c) { |
910 var d = a.replace(/^aria-/, ""), e = axs.constants.ARIA_PROPERTIES[d], d = {na
me:a, rawValue:b}; | 1034 var d = a.replace(/^aria-/, ""), e = axs.constants.ARIA_PROPERTIES[d], d = {na
me:a, rawValue:b}; |
911 if (!e) { | 1035 if (!e) { |
912 return d.valid = !1, d.reason = '"' + a + '" is not a valid ARIA property',
d; | 1036 return d.valid = !1, d.reason = '"' + a + '" is not a valid ARIA property',
d; |
913 } | 1037 } |
914 e = e.valueType; | 1038 e = e.valueType; |
915 if (!e) { | 1039 if (!e) { |
916 return d.valid = !1, d.reason = '"' + a + '" is not a valid ARIA property',
d; | 1040 return d.valid = !1, d.reason = '"' + a + '" is not a valid ARIA property',
d; |
917 } | 1041 } |
918 switch(e) { | 1042 switch(e) { |
919 case "idref": | 1043 case "idref": |
920 a = axs.utils.isValidIDRefValue(b, c), d.valid = a.valid, d.reason = a.rea
son, d.idref = a.idref; | 1044 a = axs.utils.isValidIDRefValue(b, c), d.valid = a.valid, d.reason = a.rea
son, d.idref = a.idref; |
921 case "idref_list": | 1045 case "idref_list": |
922 a = b.split(/\s+/); | 1046 a = b.split(/\s+/); |
923 d.valid = !0; | 1047 d.valid = !0; |
924 for (b = 0;b < a.length;b++) { | 1048 for (b = 0;b < a.length;b++) { |
925 e = axs.utils.isValidIDRefValue(a[b], c), e.valid || (d.valid = !1), d.v
alues ? d.values.push(e) : d.values = [e]; | 1049 e = axs.utils.isValidIDRefValue(a[b], c), e.valid || (d.valid = !1), d.v
alues ? d.values.push(e) : d.values = [e]; |
926 } | 1050 } |
927 return d; | 1051 return d; |
928 case "integer": | 1052 case "integer": |
929 ; | |
930 case "decimal": | |
931 c = axs.utils.isValidNumber(b); | 1053 c = axs.utils.isValidNumber(b); |
932 if (!c.valid) { | 1054 if (!c.valid) { |
933 return d.valid = !1, d.reason = c.reason, d; | 1055 return d.valid = !1, d.reason = c.reason, d; |
934 } | 1056 } |
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); | 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); |
936 return d; | 1058 return d; |
| 1059 case "decimal": |
| 1060 ; |
937 case "number": | 1061 case "number": |
938 c = axs.utils.isValidNumber(b), c.valid && (d.valid = !0, d.value = c.valu
e); | 1062 c = axs.utils.isValidNumber(b); |
| 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; |
939 case "string": | 1069 case "string": |
940 return d.valid = !0, d.value = b, d; | 1070 return d.valid = !0, d.value = b, d; |
941 case "token": | 1071 case "token": |
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; | 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; |
943 case "token_list": | 1073 case "token_list": |
944 e = b.split(/\s+/); | 1074 e = b.split(/\s+/); |
945 d.valid = !0; | 1075 d.valid = !0; |
946 for (b = 0;b < e.length;b++) { | 1076 for (b = 0;b < e.length;b++) { |
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]; | 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]; |
948 } | 1078 } |
(...skipping 19 matching lines...) Expand all Loading... |
968 var b = JSON.parse(a); | 1098 var b = JSON.parse(a); |
969 } catch (c) { | 1099 } catch (c) { |
970 b = ""; | 1100 b = ""; |
971 } | 1101 } |
972 return "boolean" != typeof b ? {valid:!1, value:a, reason:'"' + a + '" is not
a true/false value'} : {valid:!0, value:b}; | 1102 return "boolean" != typeof b ? {valid:!1, value:a, reason:'"' + a + '" is not
a true/false value'} : {valid:!0, value:b}; |
973 }; | 1103 }; |
974 axs.utils.isValidIDRefValue = function(a, b) { | 1104 axs.utils.isValidIDRefValue = function(a, b) { |
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 +
'"'}; | 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 +
'"'}; |
976 }; | 1106 }; |
977 axs.utils.isValidNumber = function(a) { | 1107 axs.utils.isValidNumber = function(a) { |
978 try { | 1108 var b = {valid:!1, value:a, reason:'"' + a + '" is not a number'}; |
979 var b = JSON.parse(a); | 1109 if (!a) { |
980 } catch (c) { | 1110 return b; |
981 return{valid:!1, value:a, reason:'"' + a + '" is not a number'}; | |
982 } | 1111 } |
983 return "number" != typeof b ? {valid:!1, value:a, reason:'"' + a + '" is not a
number'} : {valid:!0, value:b}; | 1112 if (/^0x/i.test(a)) { |
| 1113 return b.reason = '"' + a + '" is not a decimal number', b; |
| 1114 } |
| 1115 a *= 1; |
| 1116 return isFinite(a) ? {valid:!0, value:a} : b; |
984 }; | 1117 }; |
985 axs.utils.isElementImplicitlyFocusable = function(a) { | 1118 axs.utils.isElementImplicitlyFocusable = function(a) { |
986 var b = a.ownerDocument.defaultView; | 1119 var b = a.ownerDocument.defaultView; |
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; | 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; |
988 }; | 1121 }; |
989 axs.utils.values = function(a) { | 1122 axs.utils.values = function(a) { |
990 var b = [], c; | 1123 var b = [], c; |
991 for (c in a) { | 1124 for (c in a) { |
992 a.hasOwnProperty(c) && "function" != typeof a[c] && b.push(a[c]); | 1125 a.hasOwnProperty(c) && "function" != typeof a[c] && b.push(a[c]); |
993 } | 1126 } |
(...skipping 26 matching lines...) Expand all Loading... |
1020 for (c = 0;c < a.parentNode.children.length;c++) { | 1153 for (c = 0;c < a.parentNode.children.length;c++) { |
1021 var e = a.parentNode.children[c]; | 1154 var e = a.parentNode.children[c]; |
1022 axs.browserUtils.matchSelector(e, b) && d++; | 1155 axs.browserUtils.matchSelector(e, b) && d++; |
1023 if (e === a) { | 1156 if (e === a) { |
1024 break; | 1157 break; |
1025 } | 1158 } |
1026 } | 1159 } |
1027 } else { | 1160 } else { |
1028 d = 1; | 1161 d = 1; |
1029 } | 1162 } |
1030 return 1 == d ? axs.utils.getQuerySelectorText(a.parentNode) + " > " + b :
axs.utils.getQuerySelectorText(a.parentNode) + " > " + b + ":nth-of-type(" + d
+ ")"; | 1163 if (1 == d) { |
| 1164 return axs.utils.getQuerySelectorText(a.parentNode) + " > " + b; |
| 1165 } |
1031 } | 1166 } |
1032 if (a.parentNode) { | 1167 if (a.parentNode) { |
1033 b = a.parentNode.children; | 1168 b = a.parentNode.children; |
1034 d = 1; | 1169 d = 1; |
1035 for (c = 0;b[c] !== a;) { | 1170 for (c = 0;b[c] !== a;) { |
1036 b[c].tagName == a.tagName && d++, c++; | 1171 b[c].tagName == a.tagName && d++, c++; |
1037 } | 1172 } |
1038 c = ""; | 1173 c = ""; |
1039 "BODY" != a.parentNode.tagName && (c = axs.utils.getQuerySelectorText(a.pa
rentNode) + " > "); | 1174 "BODY" != a.parentNode.tagName && (c = axs.utils.getQuerySelectorText(a.pa
rentNode) + " > "); |
1040 return 1 == d ? c + a.tagName : c + a.tagName + ":nth-of-type(" + d + ")"; | 1175 return 1 == d ? c + a.tagName : c + a.tagName + ":nth-of-type(" + d + ")"; |
1041 } | 1176 } |
1042 } else { | 1177 } else { |
1043 if (a.selectorText) { | 1178 if (a.selectorText) { |
1044 return a.selectorText; | 1179 return a.selectorText; |
1045 } | 1180 } |
1046 } | 1181 } |
1047 return ""; | 1182 return ""; |
1048 }; | 1183 }; |
| 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 }; |
1049 axs.properties = {}; | 1281 axs.properties = {}; |
1050 axs.properties.TEXT_CONTENT_XPATH = './/text()[normalize-space(.)!=""]/parent::*
[name()!="script"]'; | 1282 axs.properties.TEXT_CONTENT_XPATH = './/text()[normalize-space(.)!=""]/parent::*
[name()!="script"]'; |
1051 axs.properties.getFocusProperties = function(a) { | 1283 axs.properties.getFocusProperties = function(a) { |
1052 var b = {}, c = a.getAttribute("tabindex"); | 1284 var b = {}, c = a.getAttribute("tabindex"); |
1053 void 0 != c ? b.tabindex = {value:c, valid:!0} : axs.utils.isElementImplicitly
Focusable(a) && (b.implicitlyFocusable = {value:!0, valid:!0}); | 1285 void 0 != c ? b.tabindex = {value:c, valid:!0} : axs.utils.isElementImplicitly
Focusable(a) && (b.implicitlyFocusable = {value:!0, valid:!0}); |
1054 if (0 == Object.keys(b).length) { | 1286 if (0 == Object.keys(b).length) { |
1055 return null; | 1287 return null; |
1056 } | 1288 } |
1057 var d = axs.utils.elementIsTransparent(a), e = axs.utils.elementHasZeroArea(a)
, f = axs.utils.elementIsOutsideScrollArea(a), g = axs.utils.overlappingElements
(a); | 1289 var d = axs.utils.elementIsTransparent(a), e = axs.utils.elementHasZeroArea(a)
, f = axs.utils.elementIsOutsideScrollArea(a), g = axs.utils.overlappingElements
(a); |
1058 if (d || e || f || 0 < g.length) { | 1290 if (d || e || f || 0 < g.length) { |
(...skipping 12 matching lines...) Expand all Loading... |
1071 return b; | 1303 return b; |
1072 }; | 1304 }; |
1073 axs.properties.getHiddenReason = function(a) { | 1305 axs.properties.getHiddenReason = function(a) { |
1074 if (!(a && a instanceof a.ownerDocument.defaultView.HTMLElement)) { | 1306 if (!(a && a instanceof a.ownerDocument.defaultView.HTMLElement)) { |
1075 return null; | 1307 return null; |
1076 } | 1308 } |
1077 if (a.hasAttribute("chromevoxignoreariahidden")) { | 1309 if (a.hasAttribute("chromevoxignoreariahidden")) { |
1078 var b = !0 | 1310 var b = !0 |
1079 } | 1311 } |
1080 var c = window.getComputedStyle(a, null); | 1312 var c = window.getComputedStyle(a, null); |
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)); | 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)); |
1082 }; | 1314 }; |
1083 axs.properties.getColorProperties = function(a) { | 1315 axs.properties.getColorProperties = function(a) { |
1084 var b = {}; | 1316 var b = {}; |
1085 (a = axs.properties.getContrastRatioProperties(a)) && (b.contrastRatio = a); | 1317 (a = axs.properties.getContrastRatioProperties(a)) && (b.contrastRatio = a); |
1086 return 0 == Object.keys(b).length ? null : b; | 1318 return 0 == Object.keys(b).length ? null : b; |
1087 }; | 1319 }; |
1088 axs.properties.hasDirectTextDescendant = function(a) { | 1320 axs.properties.hasDirectTextDescendant = function(a) { |
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()) { | 1321 function b() { |
1090 if (d === a) { | 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()) { |
1091 c = !0; | 1323 if (e === a) { |
1092 break; | 1324 return !0; |
| 1325 } |
1093 } | 1326 } |
| 1327 return !1; |
1094 } | 1328 } |
1095 return c; | 1329 var 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 }(); |
1096 }; | 1340 }; |
1097 axs.properties.getContrastRatioProperties = function(a) { | 1341 axs.properties.getContrastRatioProperties = function(a) { |
1098 if (!axs.properties.hasDirectTextDescendant(a)) { | 1342 if (!axs.properties.hasDirectTextDescendant(a)) { |
1099 return null; | 1343 return null; |
1100 } | 1344 } |
1101 var b = {}, c = window.getComputedStyle(a, null), d = axs.utils.getBgColor(c,
a); | 1345 var b = {}, c = window.getComputedStyle(a, null), d = axs.utils.getBgColor(c,
a); |
1102 if (!d) { | 1346 if (!d) { |
1103 return null; | 1347 return null; |
1104 } | 1348 } |
1105 b.backgroundColor = axs.utils.colorToString(d); | 1349 b.backgroundColor = axs.color.colorToString(d); |
1106 var e = axs.utils.getFgColor(c, a, d); | 1350 var e = axs.utils.getFgColor(c, a, d); |
1107 b.foregroundColor = axs.utils.colorToString(e); | 1351 b.foregroundColor = axs.color.colorToString(e); |
1108 a = axs.utils.getContrastRatioForElementWithComputedStyle(c, a); | 1352 a = axs.utils.getContrastRatioForElementWithComputedStyle(c, a); |
1109 if (!a) { | 1353 if (!a) { |
1110 return null; | 1354 return null; |
1111 } | 1355 } |
1112 b.value = a.toFixed(2); | 1356 b.value = a.toFixed(2); |
1113 axs.utils.isLowContrast(a, c) && (b.alert = !0); | 1357 axs.utils.isLowContrast(a, c) && (b.alert = !0); |
1114 (c = axs.utils.suggestColors(d, e, a, c)) && Object.keys(c).length && (b.sugge
stedColors = c); | 1358 var f = axs.utils.isLargeFont(c) ? 3 : 4.5, c = axs.utils.isLargeFont(c) ? 4.5
: 7, g = {}; |
| 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); |
1115 return b; | 1365 return b; |
1116 }; | 1366 }; |
1117 axs.properties.findTextAlternatives = function(a, b, c, d) { | 1367 axs.properties.findTextAlternatives = function(a, b, c, d) { |
1118 var e = c || !1; | 1368 var e = c || !1; |
1119 c = axs.utils.asElement(a); | 1369 c = axs.dom.asElement(a); |
1120 if (!c || !e && !d && axs.utils.isElementOrAncestorHidden(c)) { | 1370 if (!c || !d && axs.utils.isElementOrAncestorHidden(c)) { |
1121 return null; | 1371 return null; |
1122 } | 1372 } |
1123 if (a.nodeType == Node.TEXT_NODE) { | 1373 if (a.nodeType == Node.TEXT_NODE) { |
1124 return c = {type:"text"}, c.text = a.textContent, c.lastWord = axs.propertie
s.getLastWord(c.text), b.content = c, a.textContent; | 1374 return c = {type:"text"}, c.text = a.textContent, c.lastWord = axs.propertie
s.getLastWord(c.text), b.content = c, a.textContent; |
1125 } | 1375 } |
1126 a = null; | 1376 a = null; |
1127 e || (a = axs.properties.getTextFromAriaLabelledby(c, b)); | 1377 e || (a = axs.properties.getTextFromAriaLabelledby(c, b)); |
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); | 1378 if (c.hasAttribute("aria-label")) { |
| 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 } |
1129 c.hasAttribute("role") && "presentation" == c.getAttribute("role") || (a = axs
.properties.getTextFromHostLanguageAttributes(c, b, a, e)); | 1385 c.hasAttribute("role") && "presentation" == c.getAttribute("role") || (a = axs
.properties.getTextFromHostLanguageAttributes(c, b, a, e)); |
1130 if (e && axs.utils.elementIsHtmlControl(c)) { | 1386 if (e && axs.utils.elementIsHtmlControl(c)) { |
1131 d = c.ownerDocument.defaultView; | 1387 f = c.ownerDocument.defaultView; |
1132 if (c instanceof d.HTMLInputElement) { | 1388 if (c instanceof f.HTMLInputElement) { |
1133 var f = c; | 1389 var g = c; |
1134 "text" == f.type && f.value && 0 < f.value.length && (b.controlValue = {te
xt:f.value}); | 1390 "text" == g.type && g.value && 0 < g.value.length && (b.controlValue = {te
xt:g.value}); |
1135 "range" == f.type && (b.controlValue = {text:f.value}); | 1391 "range" == g.type && (b.controlValue = {text:g.value}); |
1136 } | 1392 } |
1137 c instanceof d.HTMLSelectElement && (b.controlValue = {text:c.value}); | 1393 c instanceof f.HTMLSelectElement && (b.controlValue = {text:c.value}); |
1138 b.controlValue && (d = b.controlValue, a ? d.unused = !0 : a = d.text); | 1394 b.controlValue && (f = b.controlValue, a ? f.unused = !0 : a = f.text); |
1139 } | 1395 } |
1140 if (e && axs.utils.elementIsAriaWidget(c)) { | 1396 if (e && axs.utils.elementIsAriaWidget(c)) { |
1141 e = c.getAttribute("role"); | 1397 e = c.getAttribute("role"); |
1142 "textbox" == e && c.textContent && 0 < c.textContent.length && (b.controlVal
ue = {text:c.textContent}); | 1398 "textbox" == e && c.textContent && 0 < c.textContent.length && (b.controlVal
ue = {text:c.textContent}); |
1143 if ("slider" == e || "spinbutton" == e) { | 1399 if ("slider" == e || "spinbutton" == e) { |
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")}); | 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")}); |
1145 } | 1401 } |
1146 if ("menu" == e) { | 1402 if ("menu" == e) { |
1147 var g = c.querySelectorAll("[role=menuitemcheckbox], [role=menuitemradio]"
); | 1403 for (var h = c.querySelectorAll("[role=menuitemcheckbox], [role=menuitemra
dio]"), f = [], g = 0;g < h.length;g++) { |
1148 d = []; | 1404 "true" == h[g].getAttribute("aria-checked") && f.push(h[g]); |
1149 for (f = 0;f < g.length;f++) { | |
1150 "true" == g[f].getAttribute("aria-checked") && d.push(g[f]); | |
1151 } | 1405 } |
1152 if (0 < d.length) { | 1406 if (0 < f.length) { |
1153 g = ""; | 1407 h = ""; |
1154 for (f = 0;f < d.length;f++) { | 1408 for (g = 0;g < f.length;g++) { |
1155 g += axs.properties.findTextAlternatives(d[f], {}, !0), f < d.length -
1 && (g += ", "); | 1409 h += axs.properties.findTextAlternatives(f[g], {}, !0), g < f.length -
1 && (h += ", "); |
1156 } | 1410 } |
1157 b.controlValue = {text:g}; | 1411 b.controlValue = {text:h}; |
1158 } | 1412 } |
1159 } | 1413 } |
1160 if ("combobox" == e || "select" == e) { | 1414 if ("combobox" == e || "select" == e) { |
1161 b.controlValue = {text:"TODO"}; | 1415 b.controlValue = {text:"TODO"}; |
1162 } | 1416 } |
1163 b.controlValue && (d = b.controlValue, a ? d.unused = !0 : a = d.text); | 1417 b.controlValue && (f = b.controlValue, a ? f.unused = !0 : a = f.text); |
1164 } | 1418 } |
1165 d = !0; | 1419 f = !0; |
1166 c.hasAttribute("role") && (e = c.getAttribute("role"), (e = axs.constants.ARIA
_ROLES[e]) && (!e.namefrom || 0 > e.namefrom.indexOf("contents")) && (d = !1)); | 1420 c.hasAttribute("role") && (e = c.getAttribute("role"), (e = axs.constants.ARIA
_ROLES[e]) && (!e.namefrom || 0 > e.namefrom.indexOf("contents")) && (f = !1)); |
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); | 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); |
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); | 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); |
1169 return 0 == Object.keys(b).length && null == a ? null : a; | 1423 return 0 == Object.keys(b).length && null == a ? null : a; |
1170 }; | 1424 }; |
1171 axs.properties.getTextFromDescendantContent = function(a) { | 1425 axs.properties.getTextFromDescendantContent = function(a, b) { |
1172 var b = a.childNodes; | 1426 for (var c = a.childNodes, d = [], e = 0;e < c.length;e++) { |
1173 a = []; | 1427 var f = axs.properties.findTextAlternatives(c[e], {}, !0, b); |
1174 for (var c = 0;c < b.length;c++) { | 1428 f && d.push(f.trim()); |
1175 var d = axs.properties.findTextAlternatives(b[c], {}, !0); | |
1176 d && a.push(d.trim()); | |
1177 } | 1429 } |
1178 if (a.length) { | 1430 if (d.length) { |
1179 b = ""; | 1431 c = ""; |
1180 for (c = 0;c < a.length;c++) { | 1432 for (e = 0;e < d.length;e++) { |
1181 b = [b, a[c]].join(" ").trim(); | 1433 c = [c, d[e]].join(" ").trim(); |
1182 } | 1434 } |
1183 return b; | 1435 return c; |
1184 } | 1436 } |
1185 return null; | 1437 return null; |
1186 }; | 1438 }; |
1187 axs.properties.getTextFromAriaLabelledby = function(a, b) { | 1439 axs.properties.getTextFromAriaLabelledby = function(a, b) { |
1188 var c = null; | 1440 var c = null; |
1189 if (!a.hasAttribute("aria-labelledby")) { | 1441 if (!a.hasAttribute("aria-labelledby")) { |
1190 return c; | 1442 return c; |
1191 } | 1443 } |
1192 for (var d = a.getAttribute("aria-labelledby").split(/\s+/), e = {valid:!0}, f
= [], g = [], h = 0;h < d.length;h++) { | 1444 for (var d = a.getAttribute("aria-labelledby").split(/\s+/), e = {valid:!0}, f
= [], g = [], h = 0;h < d.length;h++) { |
1193 var k = {type:"element"}, m = d[h]; | 1445 var k = {type:"element"}, m = d[h]; |
1194 k.value = m; | 1446 k.value = m; |
1195 var l = document.getElementById(m); | 1447 var l = document.getElementById(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]}); | 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]}); |
1197 g.push(k); | 1449 g.push(k); |
1198 } | 1450 } |
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); | 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); |
1200 return c; | 1452 return c; |
1201 }; | 1453 }; |
1202 axs.properties.getTextFromHostLanguageAttributes = function(a, b, c, d) { | 1454 axs.properties.getTextFromHostLanguageAttributes = function(a, b, c, d) { |
1203 if (axs.browserUtils.matchSelector(a, "img")) { | 1455 if (axs.browserUtils.matchSelector(a, "img") && a.hasAttribute("alt")) { |
1204 if (a.hasAttribute("alt")) { | 1456 var e = {type:"string", valid:!0}; |
1205 var e = {type:"string", valid:!0}; | 1457 e.text = a.getAttribute("alt"); |
1206 e.text = a.getAttribute("alt"); | 1458 c ? e.unused = !0 : c = e.text; |
1207 c ? e.unused = !0 : c = e.text; | 1459 b.alt = e; |
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 } | |
1212 } | 1460 } |
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) { | 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) { |
1214 if (a.hasAttribute("id")) { | 1462 if (a.hasAttribute("id")) { |
1215 d = document.querySelectorAll('label[for="' + a.id + '"]'); | 1463 d = document.querySelectorAll('label[for="' + a.id + '"]'); |
1216 for (var e = {}, f = [], g = [], h = 0;h < d.length;h++) { | 1464 for (var e = {}, f = [], g = [], h = 0;h < d.length;h++) { |
1217 var k = {type:"element"}, m = d[h], l = axs.properties.findTextAlternati
ves(m, {}, !0); | 1465 var k = {type:"element"}, m = d[h], l = axs.properties.findTextAlternati
ves(m, {}, !0); |
1218 l && 0 < l.trim().length && (k.text = l.trim(), g.push(l.trim())); | 1466 l && 0 < l.trim().length && (k.text = l.trim(), g.push(l.trim())); |
1219 k.element = m; | 1467 k.element = m; |
1220 f.push(k); | 1468 f.push(k); |
1221 } | 1469 } |
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); | 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); |
1223 } | 1471 } |
1224 d = axs.utils.parentElement(a); | 1472 d = axs.dom.parentElement(a); |
1225 for (e = {};d;) { | 1473 for (e = {};d;) { |
1226 if ("label" == d.tagName.toLowerCase() && (f = d, f.control == a)) { | 1474 if ("label" == d.tagName.toLowerCase() && (f = d, f.control == a)) { |
1227 e.type = "element"; | 1475 e.type = "element"; |
1228 e.text = axs.properties.findTextAlternatives(f, {}, !0); | 1476 e.text = axs.properties.findTextAlternatives(f, {}, !0); |
1229 e.lastWord = axs.properties.getLastWord(e.text); | 1477 e.lastWord = axs.properties.getLastWord(e.text); |
1230 e.element = f; | 1478 e.element = f; |
1231 break; | 1479 break; |
1232 } | 1480 } |
1233 d = axs.utils.parentElement(d); | 1481 d = axs.dom.parentElement(d); |
1234 } | 1482 } |
1235 e.text && (c ? e.unused = !0 : c = e.text, b.labelWrapped = e); | 1483 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); |
1236 Object.keys(b).length || (b.noLabel = !0); | 1485 Object.keys(b).length || (b.noLabel = !0); |
1237 } | 1486 } |
1238 return c; | 1487 return c; |
1239 }; | 1488 }; |
1240 axs.properties.getLastWord = function(a) { | 1489 axs.properties.getLastWord = function(a) { |
1241 if (!a) { | 1490 if (!a) { |
1242 return null; | 1491 return null; |
1243 } | 1492 } |
1244 var b = a.lastIndexOf(" ") + 1, c = a.length - 10; | 1493 var b = a.lastIndexOf(" ") + 1, c = a.length - 10; |
1245 return a.substring(b > c ? b : c); | 1494 return a.substring(b > c ? b : c); |
1246 }; | 1495 }; |
1247 axs.properties.getTextProperties = function(a) { | 1496 axs.properties.getTextProperties = function(a) { |
1248 var b = {}; | 1497 var b = {}, c = axs.properties.findTextAlternatives(a, b, !1, !0); |
1249 a = axs.properties.findTextAlternatives(a, b, !1, !0); | 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)) { |
1250 if (0 == Object.keys(b).length) { | 1499 return null; |
1251 if (!a) { | |
1252 return null; | |
1253 } | |
1254 b.hasProperties = !1; | |
1255 } else { | |
1256 b.hasProperties = !0; | |
1257 } | 1500 } |
1258 b.computedText = a; | 1501 b.hasProperties = Boolean(Object.keys(b).length); |
1259 b.lastWord = axs.properties.getLastWord(a); | 1502 b.computedText = c; |
| 1503 b.lastWord = axs.properties.getLastWord(c); |
1260 return b; | 1504 return b; |
1261 }; | 1505 }; |
1262 axs.properties.getAriaProperties = function(a) { | 1506 axs.properties.getAriaProperties = function(a) { |
1263 var b = {}, c = axs.properties.getGlobalAriaProperties(a), d; | 1507 var b = {}, c = axs.properties.getGlobalAriaProperties(a), d; |
1264 for (d in axs.constants.ARIA_PROPERTIES) { | 1508 for (d in axs.constants.ARIA_PROPERTIES) { |
1265 var e = "aria-" + d; | 1509 var e = "aria-" + d; |
1266 if (a.hasAttribute(e)) { | 1510 if (a.hasAttribute(e)) { |
1267 var f = a.getAttribute(e); | 1511 var f = a.getAttribute(e); |
1268 c[e] = axs.utils.getAriaPropertyValue(e, f, a); | 1512 c[e] = axs.utils.getAriaPropertyValue(e, f, a); |
1269 } | 1513 } |
(...skipping 12 matching lines...) Expand all Loading... |
1282 if (h.details && h.details.propertiesSet) { | 1526 if (h.details && h.details.propertiesSet) { |
1283 for (d in h.details.propertiesSet) { | 1527 for (d in h.details.propertiesSet) { |
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"})); | 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"})); |
1285 } | 1529 } |
1286 } | 1530 } |
1287 } | 1531 } |
1288 0 < Object.keys(c).length && (b.properties = axs.utils.values(c)); | 1532 0 < Object.keys(c).length && (b.properties = axs.utils.values(c)); |
1289 return 0 < Object.keys(b).length ? b : null; | 1533 return 0 < Object.keys(b).length ? b : null; |
1290 }; | 1534 }; |
1291 axs.properties.getGlobalAriaProperties = function(a) { | 1535 axs.properties.getGlobalAriaProperties = function(a) { |
1292 for (var b = {}, c = 0;c < axs.constants.GLOBAL_PROPERTIES.length;c++) { | 1536 var b = {}, c; |
1293 var d = axs.constants.GLOBAL_PROPERTIES[c]; | 1537 for (c in axs.constants.GLOBAL_PROPERTIES) { |
1294 if (a.hasAttribute(d)) { | 1538 if (a.hasAttribute(c)) { |
1295 var e = a.getAttribute(d); | 1539 var d = a.getAttribute(c); |
1296 b[d] = axs.utils.getAriaPropertyValue(d, e, a); | 1540 b[c] = axs.utils.getAriaPropertyValue(c, d, a); |
1297 } | 1541 } |
1298 } | 1542 } |
1299 return b; | 1543 return b; |
1300 }; | 1544 }; |
1301 axs.properties.getVideoProperties = function(a) { | 1545 axs.properties.getVideoProperties = function(a) { |
1302 if (!axs.browserUtils.matchSelector(a, "video")) { | 1546 if (!axs.browserUtils.matchSelector(a, "video")) { |
1303 return null; | 1547 return null; |
1304 } | 1548 } |
1305 var b = {}; | 1549 var b = {}; |
1306 b.captionTracks = axs.properties.getTrackElements(a, "captions"); | 1550 b.captionTracks = axs.properties.getTrackElements(a, "captions"); |
(...skipping 14 matching lines...) Expand all Loading... |
1321 m && (h += m, k && (h += " ")); | 1565 m && (h += m, k && (h += " ")); |
1322 k && (h += "(" + k + ")"); | 1566 k && (h += "(" + k + ")"); |
1323 "" == h && (h = "[[object Object]]"); | 1567 "" == h && (h = "[[object Object]]"); |
1324 g.name = h; | 1568 g.name = h; |
1325 e.push(g); | 1569 e.push(g); |
1326 } | 1570 } |
1327 d.values = e; | 1571 d.values = e; |
1328 return d; | 1572 return d; |
1329 }; | 1573 }; |
1330 axs.properties.getAllProperties = function(a) { | 1574 axs.properties.getAllProperties = function(a) { |
1331 var b = axs.utils.asElement(a); | 1575 var b = axs.dom.asElement(a); |
1332 if (!b) { | 1576 if (!b) { |
1333 return{}; | 1577 return {}; |
1334 } | 1578 } |
1335 var c = {}; | 1579 var c = {}; |
1336 c.ariaProperties = axs.properties.getAriaProperties(b); | 1580 c.ariaProperties = axs.properties.getAriaProperties(b); |
1337 c.colorProperties = axs.properties.getColorProperties(b); | 1581 c.colorProperties = axs.properties.getColorProperties(b); |
1338 c.focusProperties = axs.properties.getFocusProperties(b); | 1582 c.focusProperties = axs.properties.getFocusProperties(b); |
1339 c.textProperties = axs.properties.getTextProperties(a); | 1583 c.textProperties = axs.properties.getTextProperties(a); |
1340 c.videoProperties = axs.properties.getVideoProperties(b); | 1584 c.videoProperties = axs.properties.getVideoProperties(b); |
1341 return c; | 1585 return c; |
1342 }; | 1586 }; |
| 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 })(); |
1343 axs.AuditRule = function(a) { | 1661 axs.AuditRule = function(a) { |
1344 for (var b = !0, c = [], d = 0;d < axs.AuditRule.requiredFields.length;d++) { | 1662 for (var b = !0, c = [], d = 0;d < axs.AuditRule.requiredFields.length;d++) { |
1345 var e = axs.AuditRule.requiredFields[d]; | 1663 var e = axs.AuditRule.requiredFields[d]; |
1346 e in a || (b = !1, c.push(e)); | 1664 e in a || (b = !1, c.push(e)); |
1347 } | 1665 } |
1348 if (!b) { | 1666 if (!b) { |
1349 throw "Invalid spec; the following fields were not specified: " + c.join(",
") + "\n" + JSON.stringify(a); | 1667 throw "Invalid spec; the following fields were not specified: " + c.join(",
") + "\n" + JSON.stringify(a); |
1350 } | 1668 } |
1351 this.name = a.name; | 1669 this.name = a.name; |
1352 this.severity = a.severity; | 1670 this.severity = a.severity; |
1353 this.relevantElementMatcher_ = a.relevantElementMatcher; | 1671 this.relevantElementMatcher_ = a.relevantElementMatcher; |
1354 this.test_ = a.test; | 1672 this.test_ = a.test; |
1355 this.code = a.code; | 1673 this.code = a.code; |
1356 this.heading = a.heading || ""; | 1674 this.heading = a.heading || ""; |
1357 this.url = a.url || ""; | 1675 this.url = a.url || ""; |
1358 this.requiresConsoleAPI = !!a.opt_requiresConsoleAPI; | 1676 this.requiresConsoleAPI = !!a.opt_requiresConsoleAPI; |
1359 }; | 1677 }; |
1360 axs.AuditRule.requiredFields = "name severity relevantElementMatcher test code h
eading".split(" "); | 1678 axs.AuditRule.requiredFields = "name severity relevantElementMatcher test code h
eading".split(" "); |
1361 axs.AuditRule.NOT_APPLICABLE = {result:axs.constants.AuditResult.NA}; | 1679 axs.AuditRule.NOT_APPLICABLE = {result:axs.constants.AuditResult.NA}; |
1362 axs.AuditRule.prototype.addElement = function(a, b) { | 1680 axs.AuditRule.prototype.addElement = function(a, b) { |
1363 a.push(b); | 1681 a.push(b); |
1364 }; | 1682 }; |
1365 axs.AuditRule.collectMatchingElements = function(a, b, c, d) { | 1683 axs.AuditRule.collectMatchingElements = function(a, b, c, d) { |
1366 if (a.nodeType == Node.ELEMENT_NODE) { | 1684 axs.dom.composedTreeSearch(a, null, {preorder:function(a) { |
1367 var e = a | 1685 if (d) { |
1368 } | 1686 for (var f = 0;f < d.length;f++) { |
1369 e && b.call(null, e) && c.push(e); | 1687 if (axs.browserUtils.matchSelector(a, d[f])) { |
1370 if (e) { | 1688 return !1; |
1371 var f = e.shadowRoot || e.webkitShadowRoot; | 1689 } |
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; | |
1387 } | 1690 } |
1388 } | 1691 } |
1389 } | 1692 b(a) && c.push(a); |
| 1693 return !0; |
| 1694 }}); |
1390 }; | 1695 }; |
1391 axs.AuditRule.prototype.run = function(a) { | 1696 axs.AuditRule.prototype.run = function(a) { |
1392 a = a || {}; | 1697 a = a || {}; |
1393 var b = "ignoreSelectors" in a ? a.ignoreSelectors : [], c = "maxResults" in a
? a.maxResults : null, d = []; | 1698 var b = "maxResults" in a ? a.maxResults : null, c = []; |
1394 axs.AuditRule.collectMatchingElements("scope" in a ? a.scope : document, this.
relevantElementMatcher_, d); | 1699 axs.AuditRule.collectMatchingElements("scope" in a ? a.scope : document, this.
relevantElementMatcher_, c, a.ignoreSelectors); |
1395 var e = []; | 1700 var d = []; |
1396 if (!d.length) { | 1701 if (!c.length) { |
1397 return{result:axs.constants.AuditResult.NA}; | 1702 return {result:axs.constants.AuditResult.NA}; |
1398 } | 1703 } |
1399 for (a = 0;a < d.length && !(null != c && e.length >= c);a++) { | 1704 for (var e = 0;e < c.length && !(null != b && d.length >= b);e++) { |
1400 var f = d[a], g; | 1705 var f = c[e]; |
1401 a: { | 1706 this.test_(f, a.config) && this.addElement(d, f); |
1402 g = f; | 1707 } |
1403 for (var h = 0;h < b.length;h++) { | 1708 a = {result:d.length ? axs.constants.AuditResult.FAIL : axs.constants.AuditRes
ult.PASS, elements:d}; |
1404 if (axs.browserUtils.matchSelector(g, b[h])) { | 1709 e < c.length && (a.resultsTruncated = !0); |
1405 g = !0; | 1710 return a; |
1406 break a; | 1711 }; |
1407 } | 1712 axs.AuditRules = {}; |
1408 } | 1713 (function() { |
1409 g = !1; | 1714 var a = {}, b = {}; |
| 1715 axs.AuditRules.specs = {}; |
| 1716 axs.AuditRules.addRule = function(c) { |
| 1717 var d = new axs.AuditRule(c); |
| 1718 if (d.code in b) { |
| 1719 throw Error('Can not add audit rule with same code: "' + d.code + '"'); |
1410 } | 1720 } |
1411 !g && this.test_(f) && this.addElement(e, f); | 1721 if (d.name in a) { |
1412 } | 1722 throw Error('Can not add audit rule with same name: "' + d.name + '"'); |
1413 b = {result:e.length ? axs.constants.AuditResult.FAIL : axs.constants.AuditRes
ult.PASS, elements:e}; | |
1414 a < d.length && (b.resultsTruncated = !0); | |
1415 return b; | |
1416 }; | |
1417 axs.AuditRule.specs = {}; | |
1418 axs.AuditRules = {}; | |
1419 axs.AuditRules.getRule = function(a) { | |
1420 if (!axs.AuditRules.rules) { | |
1421 axs.AuditRules.rules = {}; | |
1422 for (var b in axs.AuditRule.specs) { | |
1423 var c = axs.AuditRule.specs[b], d = new axs.AuditRule(c); | |
1424 axs.AuditRules.rules[c.name] = d; | |
1425 } | 1723 } |
1426 } | 1724 a[d.name] = b[d.code] = d; |
1427 return axs.AuditRules.rules[a]; | 1725 axs.AuditRules.specs[c.name] = c; |
1428 }; | 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 })(); |
1429 axs.AuditResults = function() { | 1737 axs.AuditResults = function() { |
1430 this.errors_ = []; | 1738 this.errors_ = []; |
1431 this.warnings_ = []; | 1739 this.warnings_ = []; |
1432 }; | 1740 }; |
1433 goog.exportSymbol("axs.AuditResults", axs.AuditResults); | 1741 goog.exportSymbol("axs.AuditResults", axs.AuditResults); |
1434 axs.AuditResults.prototype.addError = function(a) { | 1742 axs.AuditResults.prototype.addError = function(a) { |
1435 "" != a && this.errors_.push(a); | 1743 "" != a && this.errors_.push(a); |
1436 }; | 1744 }; |
1437 goog.exportProperty(axs.AuditResults.prototype, "addError", axs.AuditResults.pro
totype.addError); | 1745 goog.exportProperty(axs.AuditResults.prototype, "addError", axs.AuditResults.pro
totype.addError); |
1438 axs.AuditResults.prototype.addWarning = function(a) { | 1746 axs.AuditResults.prototype.addWarning = function(a) { |
(...skipping 21 matching lines...) Expand all Loading... |
1460 0 == b && (a += "\nErrors:\n"); | 1768 0 == b && (a += "\nErrors:\n"); |
1461 var c = this.errors_[b], a = a + (c + "\n\n"); | 1769 var c = this.errors_[b], a = a + (c + "\n\n"); |
1462 } | 1770 } |
1463 for (b = 0;b < this.warnings_.length;b++) { | 1771 for (b = 0;b < this.warnings_.length;b++) { |
1464 0 == b && (a += "\nWarnings:\n"), c = this.warnings_[b], a += c + "\n\n"; | 1772 0 == b && (a += "\nWarnings:\n"), c = this.warnings_[b], a += c + "\n\n"; |
1465 } | 1773 } |
1466 return a; | 1774 return a; |
1467 }; | 1775 }; |
1468 goog.exportProperty(axs.AuditResults.prototype, "toString", axs.AuditResults.pro
totype.toString); | 1776 goog.exportProperty(axs.AuditResults.prototype, "toString", axs.AuditResults.pro
totype.toString); |
1469 axs.Audit = {}; | 1777 axs.Audit = {}; |
1470 axs.AuditConfiguration = function() { | 1778 axs.AuditConfiguration = function(a) { |
| 1779 null == a && (a = {}); |
1471 this.rules_ = {}; | 1780 this.rules_ = {}; |
1472 this.maxResults = this.auditRulesToIgnore = this.auditRulesToRun = this.scope
= null; | 1781 this.maxResults = this.auditRulesToIgnore = this.auditRulesToRun = this.scope
= null; |
1473 this.withConsoleApi = !1; | 1782 this.withConsoleApi = !1; |
1474 this.showUnsupportedRulesWarning = !0; | 1783 this.showUnsupportedRulesWarning = !0; |
| 1784 for (var b in this) { |
| 1785 this.hasOwnProperty(b) && b in a && (this[b] = a[b]); |
| 1786 } |
1475 goog.exportProperty(this, "scope", this.scope); | 1787 goog.exportProperty(this, "scope", this.scope); |
1476 goog.exportProperty(this, "auditRulesToRun", this.auditRulesToRun); | 1788 goog.exportProperty(this, "auditRulesToRun", this.auditRulesToRun); |
1477 goog.exportProperty(this, "auditRulesToIgnore", this.auditRulesToIgnore); | 1789 goog.exportProperty(this, "auditRulesToIgnore", this.auditRulesToIgnore); |
1478 goog.exportProperty(this, "withConsoleApi", this.withConsoleApi); | 1790 goog.exportProperty(this, "withConsoleApi", this.withConsoleApi); |
1479 goog.exportProperty(this, "showUnsupportedRulesWarning", this.showUnsupportedR
ulesWarning); | 1791 goog.exportProperty(this, "showUnsupportedRulesWarning", this.showUnsupportedR
ulesWarning); |
1480 }; | 1792 }; |
1481 goog.exportSymbol("axs.AuditConfiguration", axs.AuditConfiguration); | 1793 goog.exportSymbol("axs.AuditConfiguration", axs.AuditConfiguration); |
1482 axs.AuditConfiguration.prototype = {ignoreSelectors:function(a, b) { | 1794 axs.AuditConfiguration.prototype = {ignoreSelectors:function(a, b) { |
1483 a in this.rules_ || (this.rules_[a] = {}); | 1795 a in this.rules_ || (this.rules_[a] = {}); |
1484 "ignore" in this.rules_[a] || (this.rules_[a].ignore = []); | 1796 "ignore" in this.rules_[a] || (this.rules_[a].ignore = []); |
1485 Array.prototype.push.call(this.rules_[a].ignore, b); | 1797 Array.prototype.push.call(this.rules_[a].ignore, b); |
1486 }, getIgnoreSelectors:function(a) { | 1798 }, getIgnoreSelectors:function(a) { |
1487 return a in this.rules_ && "ignore" in this.rules_[a] ? this.rules_[a].ignore
: []; | 1799 return a in this.rules_ && "ignore" in this.rules_[a] ? this.rules_[a].ignore
: []; |
1488 }, setSeverity:function(a, b) { | 1800 }, setSeverity:function(a, b) { |
1489 a in this.rules_ || (this.rules_[a] = {}); | 1801 a in this.rules_ || (this.rules_[a] = {}); |
1490 this.rules_[a].severity = b; | 1802 this.rules_[a].severity = b; |
1491 }, getSeverity:function(a) { | 1803 }, getSeverity:function(a) { |
1492 return a in this.rules_ && "severity" in this.rules_[a] ? this.rules_[a].sever
ity : null; | 1804 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; |
1493 }}; | 1810 }}; |
1494 goog.exportProperty(axs.AuditConfiguration.prototype, "ignoreSelectors", axs.Aud
itConfiguration.prototype.ignoreSelectors); | 1811 goog.exportProperty(axs.AuditConfiguration.prototype, "ignoreSelectors", axs.Aud
itConfiguration.prototype.ignoreSelectors); |
1495 goog.exportProperty(axs.AuditConfiguration.prototype, "getIgnoreSelectors", axs.
AuditConfiguration.prototype.getIgnoreSelectors); | 1812 goog.exportProperty(axs.AuditConfiguration.prototype, "getIgnoreSelectors", axs.
AuditConfiguration.prototype.getIgnoreSelectors); |
1496 axs.Audit.unsupportedRulesWarningShown = !1; | 1813 axs.Audit.unsupportedRulesWarningShown = !1; |
1497 axs.Audit.getRulesCannotRun = function(a) { | 1814 axs.Audit.getRulesCannotRun = function(a) { |
1498 return a.withConsoleApi ? [] : Object.keys(axs.AuditRule.specs).filter(functio
n(a) { | 1815 return a.withConsoleApi ? [] : axs.AuditRules.getRules().filter(function(a) { |
1499 return axs.AuditRules.getRule(a).requiresConsoleAPI; | 1816 return a.requiresConsoleAPI; |
1500 }).map(function(a) { | 1817 }).map(function(a) { |
1501 return axs.AuditRules.getRule(a).code; | 1818 return a.code; |
1502 }); | 1819 }); |
1503 }; | 1820 }; |
1504 axs.Audit.run = function(a) { | 1821 axs.Audit.run = function(a) { |
1505 a = a || new axs.AuditConfiguration; | 1822 a = a || new axs.AuditConfiguration; |
1506 var b = a.withConsoleApi, c = [], d; | 1823 var b = a.withConsoleApi, c = [], d; |
1507 d = a.auditRulesToRun && 0 < a.auditRulesToRun.length ? a.auditRulesToRun : Ob
ject.keys(axs.AuditRule.specs); | 1824 d = a.auditRulesToRun && 0 < a.auditRulesToRun.length ? a.auditRulesToRun : ax
s.AuditRules.getRules(!0); |
1508 if (a.auditRulesToIgnore) { | 1825 if (a.auditRulesToIgnore) { |
1509 for (var e = 0;e < a.auditRulesToIgnore.length;e++) { | 1826 for (var e = 0;e < a.auditRulesToIgnore.length;e++) { |
1510 var f = a.auditRulesToIgnore[e]; | 1827 var f = a.auditRulesToIgnore[e]; |
1511 0 > d.indexOf(f) || d.splice(d.indexOf(f), 1); | 1828 0 > d.indexOf(f) || d.splice(d.indexOf(f), 1); |
1512 } | 1829 } |
1513 } | 1830 } |
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); | 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); |
1515 for (e = 0;e < d.length;e++) { | 1832 for (e = 0;e < d.length;e++) { |
1516 var f = d[e], g = axs.AuditRules.getRule(f); | 1833 var f = d[e], g = axs.AuditRules.getRule(f); |
1517 if (g && !g.disabled && (b || !g.requiresConsoleAPI)) { | 1834 if (g && !g.disabled && (b || !g.requiresConsoleAPI)) { |
1518 var h = {}, k = a.getIgnoreSelectors(g.name); | 1835 var h = {}, k = a.getIgnoreSelectors(g.name); |
1519 if (0 < k.length || a.scope) { | 1836 if (0 < k.length || a.scope) { |
1520 h.ignoreSelectors = k; | 1837 h.ignoreSelectors = k; |
1521 } | 1838 } |
| 1839 k = a.getRuleConfig(g.name); |
| 1840 null != k && (h.config = k); |
1522 a.scope && (h.scope = a.scope); | 1841 a.scope && (h.scope = a.scope); |
1523 a.maxResults && (h.maxResults = a.maxResults); | 1842 a.maxResults && (h.maxResults = a.maxResults); |
1524 h = g.run.call(g, h); | 1843 h = g.run.call(g, h); |
1525 g = axs.utils.namedValues(g); | 1844 g = axs.utils.namedValues(g); |
1526 g.severity = a.getSeverity(f) || g.severity; | 1845 g.severity = a.getSeverity(f) || g.severity; |
1527 h.rule = g; | 1846 h.rule = g; |
1528 c.push(h); | 1847 c.push(h); |
1529 } | 1848 } |
1530 } | 1849 } |
1531 return c; | 1850 return c; |
(...skipping 20 matching lines...) Expand all Loading... |
1552 try { | 1871 try { |
1553 b += axs.utils.getQuerySelectorText(e); | 1872 b += axs.utils.getQuerySelectorText(e); |
1554 } catch (f) { | 1873 } catch (f) { |
1555 b += " tagName:" + e.tagName, b += " id:" + e.id; | 1874 b += " tagName:" + e.tagName, b += " id:" + e.id; |
1556 } | 1875 } |
1557 } | 1876 } |
1558 "" != a.rule.url && (b += "\nSee " + a.rule.url + " for more information."); | 1877 "" != a.rule.url && (b += "\nSee " + a.rule.url + " for more information."); |
1559 return b; | 1878 return b; |
1560 }; | 1879 }; |
1561 goog.exportSymbol("axs.Audit.accessibilityErrorMessage", axs.Audit.accessibility
ErrorMessage); | 1880 goog.exportSymbol("axs.Audit.accessibilityErrorMessage", axs.Audit.accessibility
ErrorMessage); |
1562 axs.AuditRule.specs.audioWithoutControls = {name:"audioWithoutControls", heading
:"Audio elements should have controls", url:"", severity:axs.constants.Severity.
WARNING, relevantElementMatcher:function(a) { | 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) { |
| 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) { |
1563 return axs.browserUtils.matchSelector(a, "audio[autoplay]"); | 1920 return axs.browserUtils.matchSelector(a, "audio[autoplay]"); |
1564 }, test:function(a) { | 1921 }, test:function(a) { |
1565 return!a.querySelectorAll("[controls]").length && 3 < a.duration; | 1922 return !a.querySelectorAll("[controls]").length && 3 < a.duration; |
1566 }, code:"AX_AUDIO_01"}; | 1923 }, code:"AX_AUDIO_01"}); |
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) { | 1924 (function() { |
1568 var b = "", c; | 1925 var a = /^aria\-/; |
1569 for (c in axs.constants.ARIA_PROPERTIES) { | 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) { |
1570 b += "[aria-" + c + "],"; | 1927 b = b.attributes; |
1571 } | 1928 for (var c = 0, d = b.length;c < d;c++) { |
1572 b = b.substring(0, b.length - 1); | 1929 if (a.test(b[c].name)) { |
| 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); |
1573 return axs.browserUtils.matchSelector(a, b); | 1947 return axs.browserUtils.matchSelector(a, b); |
1574 }, test:function(a) { | 1948 }, test:function(a) { |
1575 for (var b in axs.constants.ARIA_PROPERTIES) { | 1949 for (var b in axs.constants.ARIA_PROPERTIES) { |
1576 var c = "aria-" + b; | 1950 var c = "aria-" + b; |
1577 if (a.hasAttribute(c)) { | 1951 if (a.hasAttribute(c)) { |
1578 var d = a.getAttribute(c); | 1952 var d = a.getAttribute(c); |
1579 if (!axs.utils.getAriaPropertyValue(c, d, a).valid) { | 1953 if (!axs.utils.getAriaPropertyValue(c, d, a).valid) { |
1580 return!0; | 1954 return !0; |
1581 } | 1955 } |
1582 } | 1956 } |
1583 } | 1957 } |
1584 return!1; | 1958 return !1; |
1585 }, code:"AX_ARIA_04"}; | 1959 }, code:"AX_ARIA_04"}); |
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) { | 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) { |
1587 return axs.browserUtils.matchSelector(a, "[role]"); | 1961 return axs.browserUtils.matchSelector(a, "[role]"); |
1588 }, test:function(a) { | 1962 }, test:function(a) { |
1589 return!axs.utils.getRoles(a).valid; | 1963 return !axs.utils.getRoles(a).valid; |
1590 }, code:"AX_ARIA_01"}; | 1964 }, code:"AX_ARIA_01"}); |
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) { | 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) { |
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])')) { | 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")) { |
1593 return!1; | 1967 return !1; |
1594 } | 1968 } |
1595 if (0 <= a.tabIndex) { | 1969 if (0 <= a.tabIndex) { |
1596 return!0; | 1970 return !0; |
1597 } | 1971 } |
1598 for (a = axs.utils.parentElement(a);null != a;a = axs.utils.parentElement(a))
{ | 1972 for (a = axs.dom.parentElement(a);null != a;a = axs.dom.parentElement(a)) { |
1599 if (axs.utils.elementIsAriaWidget(a)) { | 1973 if (axs.utils.elementIsAriaWidget(a)) { |
1600 return!1; | 1974 return !1; |
1601 } | 1975 } |
1602 } | 1976 } |
1603 return!0; | 1977 return !0; |
1604 }, test:function(a) { | 1978 }, test:function(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; | 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)) { |
1606 }, code:"AX_TEXT_01", ruleName:"Controls and media elements should have labels"}
; | 1980 return !1; |
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) { | 1981 } |
| 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) { |
1608 if (!axs.browserUtils.matchSelector(a, axs.utils.FOCUSABLE_ELEMENTS_SELECTOR))
{ | 1994 if (!axs.browserUtils.matchSelector(a, axs.utils.FOCUSABLE_ELEMENTS_SELECTOR))
{ |
1609 return!1; | 1995 return !1; |
1610 } | 1996 } |
1611 if (0 <= a.tabIndex) { | 1997 if (0 <= a.tabIndex) { |
1612 return!0; | 1998 return !0; |
1613 } | 1999 } |
1614 for (a = axs.utils.parentElement(a);null != a;a = axs.utils.parentElement(a))
{ | 2000 for (var b = axs.dom.parentElement(a);null != b;b = axs.dom.parentElement(b))
{ |
1615 if (axs.utils.elementIsAriaWidget(a)) { | 2001 if (axs.utils.elementIsAriaWidget(b)) { |
1616 return!1; | 2002 return !1; |
1617 } | 2003 } |
1618 } | 2004 } |
1619 return!0; | 2005 a = axs.properties.findTextAlternatives(a, {}); |
| 2006 return null === a || "" === a.trim() ? !1 : !0; |
1620 }, test:function(a) { | 2007 }, test:function(a) { |
1621 if (axs.utils.isElementOrAncestorHidden(a)) { | 2008 if (axs.utils.isElementOrAncestorHidden(a)) { |
1622 return!1; | 2009 return !1; |
1623 } | 2010 } |
1624 a.focus(); | 2011 a.focus(); |
1625 return!axs.utils.elementIsVisible(a); | 2012 return !axs.utils.elementIsVisible(a); |
1626 }, code:"AX_FOCUS_01"}; | 2013 }, code:"AX_FOCUS_01"}); |
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) { | 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) { |
| 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) { |
1628 return axs.browserUtils.matchSelector(a, "img") && !axs.utils.isElementOrAnces
torHidden(a); | 2020 return axs.browserUtils.matchSelector(a, "img") && !axs.utils.isElementOrAnces
torHidden(a); |
1629 }, test:function(a) { | 2021 }, test:function(a) { |
1630 return!a.hasAttribute("alt") && "presentation" != a.getAttribute("role"); | 2022 if (a.hasAttribute("alt") && "" == a.alt || "presentation" == a.getAttribute("
role")) { |
1631 }, code:"AX_TEXT_02"}; | 2023 return !1; |
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) { | 2024 } |
1633 return axs.browserUtils.matchSelector(a, "a"); | 2025 var b = {}; |
1634 }, test:function(a) { | 2026 axs.properties.findTextAlternatives(a, b); |
1635 return/^\s*click\s*here\s*[^a-z]?$/i.test(a.textContent); | 2027 return 0 == Object.keys(b).length ? !0 : !1; |
1636 }, code:"AX_TITLE_01"}; | 2028 }, code:"AX_TEXT_02"}); |
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) { | 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) { |
1638 return axs.properties.hasDirectTextDescendant(a); | 2030 return axs.browserUtils.matchSelector(a, "a[href]") && !axs.utils.isElementOrA
ncestorHidden(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); |
1639 }, test:function(a) { | 2053 }, test:function(a) { |
1640 var b = window.getComputedStyle(a, null); | 2054 var b = window.getComputedStyle(a, null); |
1641 return(a = axs.utils.getContrastRatioForElementWithComputedStyle(b, a)) && axs
.utils.isLowContrast(a, b); | 2055 return (a = axs.utils.getContrastRatioForElementWithComputedStyle(b, a)) && ax
s.utils.isLowContrast(a, b); |
1642 }, code:"AX_COLOR_01"}; | 2056 }, code:"AX_COLOR_01"}); |
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)
{ | 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) { |
1644 return axs.browserUtils.matchSelector(a, "[role~=main]"); | 2058 return axs.browserUtils.matchSelector(a, "[role~=main]"); |
1645 }, test:function(a) { | 2059 }, test:function(a) { |
1646 if (axs.utils.isInlineElement(a)) { | 2060 if (axs.utils.isInlineElement(a)) { |
1647 return!0; | 2061 return !0; |
1648 } | 2062 } |
1649 a = axs.properties.getTextFromDescendantContent(a); | 2063 a = axs.properties.getTextFromDescendantContent(a); |
1650 return!a || 50 > a.length ? !0 : !1; | 2064 return !a || 50 > a.length ? !0 : !1; |
1651 }, code:"AX_ARIA_04"}; | 2065 }, code:"AX_ARIA_05"}); |
1652 axs.AuditRule.specs.elementsWithMeaningfulBackgroundImage = {name:"elementsWithM
eaningfulBackgroundImage", severity:axs.constants.Severity.WARNING, relevantElem
entMatcher:function(a) { | 2066 axs.AuditRules.addRule({name:"elementsWithMeaningfulBackgroundImage", severity:a
xs.constants.Severity.WARNING, relevantElementMatcher:function(a) { |
1653 return!axs.utils.isElementOrAncestorHidden(a); | 2067 return !axs.utils.isElementOrAncestorHidden(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) { | 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) { |
1655 if (a.textContent && 0 < a.textContent.length) { | 2069 if (a.textContent && 0 < a.textContent.length) { |
1656 return!1; | 2070 return !1; |
1657 } | 2071 } |
1658 a = window.getComputedStyle(a, null); | 2072 a = window.getComputedStyle(a, null); |
1659 var b = a.backgroundImage; | 2073 var b = a.backgroundImage; |
1660 if (!b || "undefined" === b || "none" === b || 0 != b.indexOf("url")) { | 2074 if (!b || "undefined" === b || "none" === b || 0 != b.indexOf("url")) { |
1661 return!1; | 2075 return !1; |
1662 } | 2076 } |
1663 b = parseInt(a.width, 10); | 2077 b = parseInt(a.width, 10); |
1664 a = parseInt(a.height, 10); | 2078 a = parseInt(a.height, 10); |
1665 return 150 > b && 150 > a; | 2079 return 150 > b && 150 > a; |
1666 }, code:"AX_IMAGE_01"}; | 2080 }, code:"AX_IMAGE_01"}); |
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) { | 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)
{ |
1668 return axs.browserUtils.matchSelector(a, "[aria-labelledby]"); | 2082 return axs.browserUtils.matchSelector(a, "[aria-owns]"); |
1669 }, test:function(a) { | 2083 }, test:function(a) { |
1670 a = a.getAttribute("aria-labelledby").split(/\s+/); | 2084 return axs.utils.getIdReferents("aria-owns", a).some(function(a) { |
1671 for (var b = 0;b < a.length;b++) { | 2085 return 1 < axs.utils.getAriaIdReferrers(a, "aria-owns").length; |
1672 if (!document.getElementById(a[b])) { | 2086 }); |
1673 return!0; | 2087 }, code:"AX_ARIA_07"}); |
1674 } | 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) { |
1675 } | 2089 return axs.browserUtils.matchSelector(a, "label"); |
1676 return!1; | 2090 }, test:function(a) { |
1677 }, code:"AX_ARIA_02"}; | 2091 if (1 < a.querySelectorAll(axs.utils.LABELABLE_ELEMENTS_SELECTOR).length) { |
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) { | 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 } |
| 2107 } |
| 2108 return !1; |
| 2109 }, 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) { |
1679 return "html" == a.tagName.toLowerCase(); | 2111 return "html" == a.tagName.toLowerCase(); |
1680 }, test:function(a) { | 2112 }, test:function(a) { |
1681 a = a.querySelector("head"); | 2113 a = a.querySelector("head"); |
1682 return a ? (a = a.querySelector("title")) ? !a.textContent : !0 : !0; | 2114 return a ? (a = a.querySelector("title")) ? !a.textContent : !0 : !0; |
1683 }, code:"AX_TITLE_01"}; | 2115 }, code:"AX_TITLE_01"}); |
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) { | 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) { |
1685 return axs.browserUtils.matchSelector(a, "[role]"); | 2117 return axs.browserUtils.matchSelector(a, "[role]"); |
1686 }, test:function(a) { | 2118 }, test:function(a) { |
1687 var b = axs.utils.getRoles(a); | 2119 var b = axs.utils.getRoles(a); |
1688 if (!b.valid) { | 2120 if (!b.valid) { |
1689 return!1; | 2121 return !1; |
1690 } | 2122 } |
1691 for (var c = 0;c < b.roles.length;c++) { | 2123 for (var c = 0;c < b.roles.length;c++) { |
1692 var d = b.roles[c].details.requiredPropertiesSet, e; | 2124 var d = b.roles[c].details.requiredPropertiesSet, e; |
1693 for (e in d) { | 2125 for (e in d) { |
1694 if (d = e.replace(/^aria-/, ""), !("defaultValue" in axs.constants.ARIA_PR
OPERTIES[d] || a.hasAttribute(e))) { | 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)) { |
1695 return!0; | 2127 return !0; |
1696 } | 2128 } |
1697 } | 2129 } |
1698 } | 2130 } |
1699 }, code:"AX_ARIA_03"}; | 2131 }, code:"AX_ARIA_03"}); |
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) { | 2132 (function() { |
| 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) { |
1701 return a instanceof a.ownerDocument.defaultView.HTMLBodyElement || axs.utils.i
sElementOrAncestorHidden(a) ? !1 : "click" in getEventListeners(a) ? !0 : !1; | 2240 return a instanceof a.ownerDocument.defaultView.HTMLBodyElement || axs.utils.i
sElementOrAncestorHidden(a) ? !1 : "click" in getEventListeners(a) ? !0 : !1; |
1702 }, test:function(a) { | 2241 }, test:function(a) { |
1703 return!a.hasAttribute("tabindex") && !axs.utils.isElementImplicitlyFocusable(a
) && !a.disabled; | 2242 return !a.hasAttribute("tabindex") && !axs.utils.isElementImplicitlyFocusable(
a) && !a.disabled; |
1704 }, code:"AX_FOCUS_02"}; | 2243 }, code:"AX_FOCUS_02"}); |
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) { | 2244 (function() { |
| 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) { |
1706 return axs.browserUtils.matchSelector(a, "video"); | 2264 return axs.browserUtils.matchSelector(a, "video"); |
1707 }, test:function(a) { | 2265 }, test:function(a) { |
1708 return!a.querySelectorAll("track[kind=captions]").length; | 2266 return !a.querySelectorAll("track[kind=captions]").length; |
1709 }, code:"AX_VIDEO_01"}; | 2267 }, code:"AX_VIDEO_01"}); |
1710 | 2268 |
| 2269 return axs; |
| 2270 }); |
1711 | 2271 |
| 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 |