| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Copyright 2014 Google Inc. | |
| 3 * | |
| 4 * Licensed under the Apache License, Version 2.0 (the "License"); | |
| 5 * you may not use this file except in compliance with the License. | |
| 6 * You may obtain a copy of the License at | |
| 7 * | |
| 8 * http://www.apache.org/licenses/LICENSE-2.0 | |
| 9 * | |
| 10 * Unless required by applicable law or agreed to in writing, software | |
| 11 * distributed under the License is distributed on an "AS IS" BASIS, | |
| 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 13 * See the License for the specific language governing permissions and | |
| 14 * limitations under the License. | |
| 15 * | |
| 16 * Generated from http://github.com/GoogleChrome/accessibility-developer-tools/t
ree/e163bc2b7769b00f1f747999ba74fcf3e69e68e3 | |
| 17 * | |
| 18 * See project README for build steps. | |
| 19 */ | |
| 20 | |
| 21 // AUTO-GENERATED CONTENT BELOW: DO NOT EDIT! See above for details. | |
| 22 | |
| 23 var COMPILED = !0, goog = goog || {}; | |
| 24 goog.global = this; | |
| 25 goog.isDef = function(a) { | |
| 26 return void 0 !== a; | |
| 27 }; | |
| 28 goog.exportPath_ = function(a, b, c) { | |
| 29 a = a.split("."); | |
| 30 c = c || goog.global; | |
| 31 a[0] in c || !c.execScript || c.execScript("var " + a[0]); | |
| 32 for (var d;a.length && (d = a.shift());) { | |
| 33 !a.length && goog.isDef(b) ? c[d] = b : c = c[d] ? c[d] : c[d] = {}; | |
| 34 } | |
| 35 }; | |
| 36 goog.define = function(a, b) { | |
| 37 var c = b; | |
| 38 COMPILED || (goog.global.CLOSURE_UNCOMPILED_DEFINES && Object.prototype.hasOwn
Property.call(goog.global.CLOSURE_UNCOMPILED_DEFINES, a) ? c = goog.global.CLOSU
RE_UNCOMPILED_DEFINES[a] : goog.global.CLOSURE_DEFINES && Object.prototype.hasOw
nProperty.call(goog.global.CLOSURE_DEFINES, a) && (c = goog.global.CLOSURE_DEFIN
ES[a])); | |
| 39 goog.exportPath_(a, c); | |
| 40 }; | |
| 41 goog.DEBUG = !0; | |
| 42 goog.LOCALE = "en"; | |
| 43 goog.TRUSTED_SITE = !0; | |
| 44 goog.STRICT_MODE_COMPATIBLE = !1; | |
| 45 goog.provide = function(a) { | |
| 46 if (!COMPILED) { | |
| 47 if (goog.isProvided_(a)) { | |
| 48 throw Error('Namespace "' + a + '" already declared.'); | |
| 49 } | |
| 50 delete goog.implicitNamespaces_[a]; | |
| 51 for (var b = a;(b = b.substring(0, b.lastIndexOf("."))) && !goog.getObjectBy
Name(b);) { | |
| 52 goog.implicitNamespaces_[b] = !0; | |
| 53 } | |
| 54 } | |
| 55 goog.exportPath_(a); | |
| 56 }; | |
| 57 goog.setTestOnly = function(a) { | |
| 58 if (COMPILED && !goog.DEBUG) { | |
| 59 throw a = a || "", Error("Importing test-only code into non-debug environmen
t" + a ? ": " + a : "."); | |
| 60 } | |
| 61 }; | |
| 62 goog.forwardDeclare = function(a) { | |
| 63 }; | |
| 64 COMPILED || (goog.isProvided_ = function(a) { | |
| 65 return!goog.implicitNamespaces_[a] && goog.isDefAndNotNull(goog.getObjectByNam
e(a)); | |
| 66 }, goog.implicitNamespaces_ = {}); | |
| 67 goog.getObjectByName = function(a, b) { | |
| 68 for (var c = a.split("."), d = b || goog.global, e;e = c.shift();) { | |
| 69 if (goog.isDefAndNotNull(d[e])) { | |
| 70 d = d[e]; | |
| 71 } else { | |
| 72 return null; | |
| 73 } | |
| 74 } | |
| 75 return d; | |
| 76 }; | |
| 77 goog.globalize = function(a, b) { | |
| 78 var c = b || goog.global, d; | |
| 79 for (d in a) { | |
| 80 c[d] = a[d]; | |
| 81 } | |
| 82 }; | |
| 83 goog.addDependency = function(a, b, c) { | |
| 84 if (goog.DEPENDENCIES_ENABLED) { | |
| 85 var d; | |
| 86 a = a.replace(/\\/g, "/"); | |
| 87 for (var e = goog.dependencies_, f = 0;d = b[f];f++) { | |
| 88 e.nameToPath[d] = a, a in e.pathToNames || (e.pathToNames[a] = {}), e.path
ToNames[a][d] = !0; | |
| 89 } | |
| 90 for (d = 0;b = c[d];d++) { | |
| 91 a in e.requires || (e.requires[a] = {}), e.requires[a][b] = !0; | |
| 92 } | |
| 93 } | |
| 94 }; | |
| 95 goog.ENABLE_DEBUG_LOADER = !0; | |
| 96 goog.require = function(a) { | |
| 97 if (!COMPILED && !goog.isProvided_(a)) { | |
| 98 if (goog.ENABLE_DEBUG_LOADER) { | |
| 99 var b = goog.getPathFromDeps_(a); | |
| 100 if (b) { | |
| 101 goog.included_[b] = !0; | |
| 102 goog.writeScripts_(); | |
| 103 return; | |
| 104 } | |
| 105 } | |
| 106 a = "goog.require could not find: " + a; | |
| 107 goog.global.console && goog.global.console.error(a); | |
| 108 throw Error(a); | |
| 109 } | |
| 110 }; | |
| 111 goog.basePath = ""; | |
| 112 goog.nullFunction = function() { | |
| 113 }; | |
| 114 goog.identityFunction = function(a, b) { | |
| 115 return a; | |
| 116 }; | |
| 117 goog.abstractMethod = function() { | |
| 118 throw Error("unimplemented abstract method"); | |
| 119 }; | |
| 120 goog.addSingletonGetter = function(a) { | |
| 121 a.getInstance = function() { | |
| 122 if (a.instance_) { | |
| 123 return a.instance_; | |
| 124 } | |
| 125 goog.DEBUG && (goog.instantiatedSingletons_[goog.instantiatedSingletons_.len
gth] = a); | |
| 126 return a.instance_ = new a; | |
| 127 }; | |
| 128 }; | |
| 129 goog.instantiatedSingletons_ = []; | |
| 130 goog.DEPENDENCIES_ENABLED = !COMPILED && goog.ENABLE_DEBUG_LOADER; | |
| 131 goog.DEPENDENCIES_ENABLED && (goog.included_ = {}, goog.dependencies_ = {pathToN
ames:{}, nameToPath:{}, requires:{}, visited:{}, written:{}}, goog.inHtmlDocumen
t_ = function() { | |
| 132 var a = goog.global.document; | |
| 133 return "undefined" != typeof a && "write" in a; | |
| 134 }, goog.findBasePath_ = function() { | |
| 135 if (goog.global.CLOSURE_BASE_PATH) { | |
| 136 goog.basePath = goog.global.CLOSURE_BASE_PATH; | |
| 137 } else { | |
| 138 if (goog.inHtmlDocument_()) { | |
| 139 for (var a = goog.global.document.getElementsByTagName("script"), b = a.le
ngth - 1;0 <= b;--b) { | |
| 140 var c = a[b].src, d = c.lastIndexOf("?"), d = -1 == d ? c.length : d; | |
| 141 if ("base.js" == c.substr(d - 7, 7)) { | |
| 142 goog.basePath = c.substr(0, d - 7); | |
| 143 break; | |
| 144 } | |
| 145 } | |
| 146 } | |
| 147 } | |
| 148 }, goog.importScript_ = function(a) { | |
| 149 var b = goog.global.CLOSURE_IMPORT_SCRIPT || goog.writeScriptTag_; | |
| 150 !goog.dependencies_.written[a] && b(a) && (goog.dependencies_.written[a] = !0)
; | |
| 151 }, goog.writeScriptTag_ = function(a) { | |
| 152 if (goog.inHtmlDocument_()) { | |
| 153 var b = goog.global.document; | |
| 154 if ("complete" == b.readyState) { | |
| 155 if (/\bdeps.js$/.test(a)) { | |
| 156 return!1; | |
| 157 } | |
| 158 throw Error('Cannot write "' + a + '" after document load'); | |
| 159 } | |
| 160 b.write('<script type="text/javascript" src="' + a + '">\x3c/script>'); | |
| 161 return!0; | |
| 162 } | |
| 163 return!1; | |
| 164 }, goog.writeScripts_ = function() { | |
| 165 function a(e) { | |
| 166 if (!(e in d.written)) { | |
| 167 if (!(e in d.visited) && (d.visited[e] = !0, e in d.requires)) { | |
| 168 for (var g in d.requires[e]) { | |
| 169 if (!goog.isProvided_(g)) { | |
| 170 if (g in d.nameToPath) { | |
| 171 a(d.nameToPath[g]); | |
| 172 } else { | |
| 173 throw Error("Undefined nameToPath for " + g); | |
| 174 } | |
| 175 } | |
| 176 } | |
| 177 } | |
| 178 e in c || (c[e] = !0, b.push(e)); | |
| 179 } | |
| 180 } | |
| 181 var b = [], c = {}, d = goog.dependencies_, e; | |
| 182 for (e in goog.included_) { | |
| 183 d.written[e] || a(e); | |
| 184 } | |
| 185 for (e = 0;e < b.length;e++) { | |
| 186 if (b[e]) { | |
| 187 goog.importScript_(goog.basePath + b[e]); | |
| 188 } else { | |
| 189 throw Error("Undefined script input"); | |
| 190 } | |
| 191 } | |
| 192 }, goog.getPathFromDeps_ = function(a) { | |
| 193 return a in goog.dependencies_.nameToPath ? goog.dependencies_.nameToPath[a] :
null; | |
| 194 }, goog.findBasePath_(), goog.global.CLOSURE_NO_DEPS || goog.importScript_(goog.
basePath + "deps.js")); | |
| 195 goog.typeOf = function(a) { | |
| 196 var b = typeof a; | |
| 197 if ("object" == b) { | |
| 198 if (a) { | |
| 199 if (a instanceof Array) { | |
| 200 return "array"; | |
| 201 } | |
| 202 if (a instanceof Object) { | |
| 203 return b; | |
| 204 } | |
| 205 var c = Object.prototype.toString.call(a); | |
| 206 if ("[object Window]" == c) { | |
| 207 return "object"; | |
| 208 } | |
| 209 if ("[object Array]" == c || "number" == typeof a.length && "undefined" !=
typeof a.splice && "undefined" != typeof a.propertyIsEnumerable && !a.propertyI
sEnumerable("splice")) { | |
| 210 return "array"; | |
| 211 } | |
| 212 if ("[object Function]" == c || "undefined" != typeof a.call && "undefined
" != typeof a.propertyIsEnumerable && !a.propertyIsEnumerable("call")) { | |
| 213 return "function"; | |
| 214 } | |
| 215 } else { | |
| 216 return "null"; | |
| 217 } | |
| 218 } else { | |
| 219 if ("function" == b && "undefined" == typeof a.call) { | |
| 220 return "object"; | |
| 221 } | |
| 222 } | |
| 223 return b; | |
| 224 }; | |
| 225 goog.isNull = function(a) { | |
| 226 return null === a; | |
| 227 }; | |
| 228 goog.isDefAndNotNull = function(a) { | |
| 229 return null != a; | |
| 230 }; | |
| 231 goog.isArray = function(a) { | |
| 232 return "array" == goog.typeOf(a); | |
| 233 }; | |
| 234 goog.isArrayLike = function(a) { | |
| 235 var b = goog.typeOf(a); | |
| 236 return "array" == b || "object" == b && "number" == typeof a.length; | |
| 237 }; | |
| 238 goog.isDateLike = function(a) { | |
| 239 return goog.isObject(a) && "function" == typeof a.getFullYear; | |
| 240 }; | |
| 241 goog.isString = function(a) { | |
| 242 return "string" == typeof a; | |
| 243 }; | |
| 244 goog.isBoolean = function(a) { | |
| 245 return "boolean" == typeof a; | |
| 246 }; | |
| 247 goog.isNumber = function(a) { | |
| 248 return "number" == typeof a; | |
| 249 }; | |
| 250 goog.isFunction = function(a) { | |
| 251 return "function" == goog.typeOf(a); | |
| 252 }; | |
| 253 goog.isObject = function(a) { | |
| 254 var b = typeof a; | |
| 255 return "object" == b && null != a || "function" == b; | |
| 256 }; | |
| 257 goog.getUid = function(a) { | |
| 258 return a[goog.UID_PROPERTY_] || (a[goog.UID_PROPERTY_] = ++goog.uidCounter_); | |
| 259 }; | |
| 260 goog.hasUid = function(a) { | |
| 261 return!!a[goog.UID_PROPERTY_]; | |
| 262 }; | |
| 263 goog.removeUid = function(a) { | |
| 264 "removeAttribute" in a && a.removeAttribute(goog.UID_PROPERTY_); | |
| 265 try { | |
| 266 delete a[goog.UID_PROPERTY_]; | |
| 267 } catch (b) { | |
| 268 } | |
| 269 }; | |
| 270 goog.UID_PROPERTY_ = "closure_uid_" + (1E9 * Math.random() >>> 0); | |
| 271 goog.uidCounter_ = 0; | |
| 272 goog.getHashCode = goog.getUid; | |
| 273 goog.removeHashCode = goog.removeUid; | |
| 274 goog.cloneObject = function(a) { | |
| 275 var b = goog.typeOf(a); | |
| 276 if ("object" == b || "array" == b) { | |
| 277 if (a.clone) { | |
| 278 return a.clone(); | |
| 279 } | |
| 280 var b = "array" == b ? [] : {}, c; | |
| 281 for (c in a) { | |
| 282 b[c] = goog.cloneObject(a[c]); | |
| 283 } | |
| 284 return b; | |
| 285 } | |
| 286 return a; | |
| 287 }; | |
| 288 goog.bindNative_ = function(a, b, c) { | |
| 289 return a.call.apply(a.bind, arguments); | |
| 290 }; | |
| 291 goog.bindJs_ = function(a, b, c) { | |
| 292 if (!a) { | |
| 293 throw Error(); | |
| 294 } | |
| 295 if (2 < arguments.length) { | |
| 296 var d = Array.prototype.slice.call(arguments, 2); | |
| 297 return function() { | |
| 298 var c = Array.prototype.slice.call(arguments); | |
| 299 Array.prototype.unshift.apply(c, d); | |
| 300 return a.apply(b, c); | |
| 301 }; | |
| 302 } | |
| 303 return function() { | |
| 304 return a.apply(b, arguments); | |
| 305 }; | |
| 306 }; | |
| 307 goog.bind = function(a, b, c) { | |
| 308 Function.prototype.bind && -1 != Function.prototype.bind.toString().indexOf("n
ative code") ? goog.bind = goog.bindNative_ : goog.bind = goog.bindJs_; | |
| 309 return goog.bind.apply(null, arguments); | |
| 310 }; | |
| 311 goog.partial = function(a, b) { | |
| 312 var c = Array.prototype.slice.call(arguments, 1); | |
| 313 return function() { | |
| 314 var b = c.slice(); | |
| 315 b.push.apply(b, arguments); | |
| 316 return a.apply(this, b); | |
| 317 }; | |
| 318 }; | |
| 319 goog.mixin = function(a, b) { | |
| 320 for (var c in b) { | |
| 321 a[c] = b[c]; | |
| 322 } | |
| 323 }; | |
| 324 goog.now = goog.TRUSTED_SITE && Date.now || function() { | |
| 325 return+new Date; | |
| 326 }; | |
| 327 goog.globalEval = function(a) { | |
| 328 if (goog.global.execScript) { | |
| 329 goog.global.execScript(a, "JavaScript"); | |
| 330 } else { | |
| 331 if (goog.global.eval) { | |
| 332 if (null == goog.evalWorksForGlobals_ && (goog.global.eval("var _et_ = 1;"
), "undefined" != typeof goog.global._et_ ? (delete goog.global._et_, goog.evalW
orksForGlobals_ = !0) : goog.evalWorksForGlobals_ = !1), goog.evalWorksForGlobal
s_) { | |
| 333 goog.global.eval(a); | |
| 334 } else { | |
| 335 var b = goog.global.document, c = b.createElement("script"); | |
| 336 c.type = "text/javascript"; | |
| 337 c.defer = !1; | |
| 338 c.appendChild(b.createTextNode(a)); | |
| 339 b.body.appendChild(c); | |
| 340 b.body.removeChild(c); | |
| 341 } | |
| 342 } else { | |
| 343 throw Error("goog.globalEval not available"); | |
| 344 } | |
| 345 } | |
| 346 }; | |
| 347 goog.evalWorksForGlobals_ = null; | |
| 348 goog.getCssName = function(a, b) { | |
| 349 var c = function(a) { | |
| 350 return goog.cssNameMapping_[a] || a; | |
| 351 }, d = function(a) { | |
| 352 a = a.split("-"); | |
| 353 for (var b = [], d = 0;d < a.length;d++) { | |
| 354 b.push(c(a[d])); | |
| 355 } | |
| 356 return b.join("-"); | |
| 357 }, d = goog.cssNameMapping_ ? "BY_WHOLE" == goog.cssNameMappingStyle_ ? c : d
: function(a) { | |
| 358 return a; | |
| 359 }; | |
| 360 return b ? a + "-" + d(b) : d(a); | |
| 361 }; | |
| 362 goog.setCssNameMapping = function(a, b) { | |
| 363 goog.cssNameMapping_ = a; | |
| 364 goog.cssNameMappingStyle_ = b; | |
| 365 }; | |
| 366 !COMPILED && goog.global.CLOSURE_CSS_NAME_MAPPING && (goog.cssNameMapping_ = goo
g.global.CLOSURE_CSS_NAME_MAPPING); | |
| 367 goog.getMsg = function(a, b) { | |
| 368 var c = b || {}, d; | |
| 369 for (d in c) { | |
| 370 var e = ("" + c[d]).replace(/\$/g, "$$$$"); | |
| 371 a = a.replace(new RegExp("\\{\\$" + d + "\\}", "gi"), e); | |
| 372 } | |
| 373 return a; | |
| 374 }; | |
| 375 goog.getMsgWithFallback = function(a, b) { | |
| 376 return a; | |
| 377 }; | |
| 378 goog.exportSymbol = function(a, b, c) { | |
| 379 goog.exportPath_(a, b, c); | |
| 380 }; | |
| 381 goog.exportProperty = function(a, b, c) { | |
| 382 a[b] = c; | |
| 383 }; | |
| 384 goog.inherits = function(a, b) { | |
| 385 function c() { | |
| 386 } | |
| 387 c.prototype = b.prototype; | |
| 388 a.superClass_ = b.prototype; | |
| 389 a.prototype = new c; | |
| 390 a.prototype.constructor = a; | |
| 391 a.base = function(a, c, f) { | |
| 392 var g = Array.prototype.slice.call(arguments, 2); | |
| 393 return b.prototype[c].apply(a, g); | |
| 394 }; | |
| 395 }; | |
| 396 goog.base = function(a, b, c) { | |
| 397 var d = arguments.callee.caller; | |
| 398 if (goog.STRICT_MODE_COMPATIBLE || goog.DEBUG && !d) { | |
| 399 throw Error("arguments.caller not defined. goog.base() cannot be used with
strict mode code. See http://www.ecma-international.org/ecma-262/5.1/#sec-C"); | |
| 400 } | |
| 401 if (d.superClass_) { | |
| 402 return d.superClass_.constructor.apply(a, Array.prototype.slice.call(argumen
ts, 1)); | |
| 403 } | |
| 404 for (var e = Array.prototype.slice.call(arguments, 2), f = !1, g = a.construct
or;g;g = g.superClass_ && g.superClass_.constructor) { | |
| 405 if (g.prototype[b] === d) { | |
| 406 f = !0; | |
| 407 } else { | |
| 408 if (f) { | |
| 409 return g.prototype[b].apply(a, e); | |
| 410 } | |
| 411 } | |
| 412 } | |
| 413 if (a[b] === d) { | |
| 414 return a.constructor.prototype[b].apply(a, e); | |
| 415 } | |
| 416 throw Error("goog.base called from a method of one name to a method of a diffe
rent name"); | |
| 417 }; | |
| 418 goog.scope = function(a) { | |
| 419 a.call(goog.global); | |
| 420 }; | |
| 421 var axs = {}; | |
| 422 axs.browserUtils = {}; | |
| 423 axs.browserUtils.matchSelector = function(a, b) { | |
| 424 return a.webkitMatchesSelector ? a.webkitMatchesSelector(b) : a.mozMatchesSele
ctor ? a.mozMatchesSelector(b) : !1; | |
| 425 }; | |
| 426 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 "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 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 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 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:["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 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 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 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 "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 "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"], 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 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 axs.constants.WIDGET_ROLES = {}; | |
| 443 axs.constants.addAllParentRolesToSet_ = function(a, b) { | |
| 444 if (a.parent) { | |
| 445 for (var c = a.parent, d = 0;d < c.length;d++) { | |
| 446 var e = c[d]; | |
| 447 b[e] = !0; | |
| 448 axs.constants.addAllParentRolesToSet_(axs.constants.ARIA_ROLES[e], b); | |
| 449 } | |
| 450 } | |
| 451 }; | |
| 452 axs.constants.addAllPropertiesToSet_ = function(a, b, c) { | |
| 453 var d = a[b]; | |
| 454 if (d) { | |
| 455 for (var e = 0;e < d.length;e++) { | |
| 456 c[d[e]] = !0; | |
| 457 } | |
| 458 } | |
| 459 if (a.parent) { | |
| 460 for (a = a.parent, d = 0;d < a.length;d++) { | |
| 461 axs.constants.addAllPropertiesToSet_(axs.constants.ARIA_ROLES[a[d]], b, c)
; | |
| 462 } | |
| 463 } | |
| 464 }; | |
| 465 for (var roleName in axs.constants.ARIA_ROLES) { | |
| 466 var role = axs.constants.ARIA_ROLES[roleName], propertiesSet = {}; | |
| 467 axs.constants.addAllPropertiesToSet_(role, "properties", propertiesSet); | |
| 468 role.propertiesSet = propertiesSet; | |
| 469 var requiredPropertiesSet = {}; | |
| 470 axs.constants.addAllPropertiesToSet_(role, "requiredProperties", requiredPrope
rtiesSet); | |
| 471 role.requiredPropertiesSet = requiredPropertiesSet; | |
| 472 var parentRolesSet = {}; | |
| 473 axs.constants.addAllParentRolesToSet_(role, parentRolesSet); | |
| 474 role.allParentRolesSet = parentRolesSet; | |
| 475 "widget" in parentRolesSet && (axs.constants.WIDGET_ROLES[roleName] = role); | |
| 476 } | |
| 477 axs.constants.ARIA_PROPERTIES = {activedescendant:{type:"property", valueType:"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 "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 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 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 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", | |
| 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"}; | |
| 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", | |
| 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"}; | |
| 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", | |
| 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", | |
| 491 "false":"aria_selected_false"}}]; | |
| 492 axs.constants.INPUT_TYPE_TO_INFORMATION_TABLE_MSG = {button:"input_type_button",
checkbox:"input_type_checkbox", color:"input_type_color", datetime:"input_type_
datetime", "datetime-local":"input_type_datetime_local", date:"input_type_date",
email:"input_type_email", file:"input_type_file", image:"input_type_image", 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"}; | |
| 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"}; | |
| 495 axs.constants.TAG_TO_INFORMATION_TABLE_BRIEF_MSG = {BUTTON:"tag_button", SELECT:
"tag_select", TEXTAREA:"tag_textarea"}; | |
| 496 axs.constants.MIXED_VALUES = {"true":!0, "false":!0, mixed:!0}; | |
| 497 (function() { | |
| 498 for (var a in axs.constants.ARIA_PROPERTIES) { | |
| 499 var b = axs.constants.ARIA_PROPERTIES[a]; | |
| 500 if (b.values) { | |
| 501 for (var c = {}, d = 0;d < b.values.length;d++) { | |
| 502 c[b.values[d]] = !0; | |
| 503 } | |
| 504 b.valuesSet = c; | |
| 505 } | |
| 506 } | |
| 507 })(); | |
| 508 axs.constants.Severity = {INFO:"Info", WARNING:"Warning", SEVERE:"Severe"}; | |
| 509 axs.constants.AuditResult = {PASS:"PASS", FAIL:"FAIL", NA:"NA"}; | |
| 510 axs.constants.InlineElements = {TT:!0, I:!0, B:!0, BIG:!0, SMALL:!0, EM:!0, 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.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.utils.Color = function(a, b, c, d) { | |
| 514 this.red = a; | |
| 515 this.green = b; | |
| 516 this.blue = c; | |
| 517 this.alpha = d; | |
| 518 }; | |
| 519 axs.utils.calculateContrastRatio = function(a, b) { | |
| 520 if (!a || !b) { | |
| 521 return null; | |
| 522 } | |
| 523 1 > a.alpha && (a = axs.utils.flattenColors(a, b)); | |
| 524 var c = axs.utils.calculateLuminance(a), d = axs.utils.calculateLuminance(b); | |
| 525 return(Math.max(c, d) + .05) / (Math.min(c, d) + .05); | |
| 526 }; | |
| 527 axs.utils.luminanceRatio = function(a, b) { | |
| 528 return(Math.max(a, b) + .05) / (Math.min(a, b) + .05); | |
| 529 }; | |
| 530 axs.utils.parentElement = function(a) { | |
| 531 if (!a) { | |
| 532 return null; | |
| 533 } | |
| 534 if (a.nodeType == Node.DOCUMENT_FRAGMENT_NODE) { | |
| 535 return a.host; | |
| 536 } | |
| 537 var b = a.parentElement; | |
| 538 if (b) { | |
| 539 return b; | |
| 540 } | |
| 541 a = a.parentNode; | |
| 542 if (!a) { | |
| 543 return null; | |
| 544 } | |
| 545 switch(a.nodeType) { | |
| 546 case Node.ELEMENT_NODE: | |
| 547 return a; | |
| 548 case Node.DOCUMENT_FRAGMENT_NODE: | |
| 549 return a.host; | |
| 550 default: | |
| 551 return null; | |
| 552 } | |
| 553 }; | |
| 554 axs.utils.asElement = function(a) { | |
| 555 switch(a.nodeType) { | |
| 556 case Node.COMMENT_NODE: | |
| 557 return null; | |
| 558 case Node.ELEMENT_NODE: | |
| 559 if ("script" == a.tagName.toLowerCase()) { | |
| 560 return null; | |
| 561 } | |
| 562 break; | |
| 563 case Node.TEXT_NODE: | |
| 564 a = axs.utils.parentElement(a); | |
| 565 break; | |
| 566 default: | |
| 567 return console.warn("Unhandled node type: ", a.nodeType), null; | |
| 568 } | |
| 569 return a; | |
| 570 }; | |
| 571 axs.utils.elementIsTransparent = function(a) { | |
| 572 return "0" == a.style.opacity; | |
| 573 }; | |
| 574 axs.utils.elementHasZeroArea = function(a) { | |
| 575 a = a.getBoundingClientRect(); | |
| 576 var b = a.top - a.bottom; | |
| 577 return a.right - a.left && b ? !1 : !0; | |
| 578 }; | |
| 579 axs.utils.elementIsOutsideScrollArea = function(a) { | |
| 580 for (var b = axs.utils.parentElement(a), c = a.ownerDocument.defaultView;b !=
c.document.body;) { | |
| 581 if (axs.utils.isClippedBy(a, b)) { | |
| 582 return!0; | |
| 583 } | |
| 584 if (axs.utils.canScrollTo(a, b) && !axs.utils.elementIsOutsideScrollArea(b))
{ | |
| 585 return!1; | |
| 586 } | |
| 587 b = axs.utils.parentElement(b); | |
| 588 } | |
| 589 return!axs.utils.canScrollTo(a, c.document.body); | |
| 590 }; | |
| 591 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; | |
| 593 if (c.right < f - b.scrollLeft || c.bottom < g || c.left > h || c.top > e) { | |
| 594 return!1; | |
| 595 } | |
| 596 f = a.ownerDocument.defaultView; | |
| 597 g = f.getComputedStyle(b); | |
| 598 return c.left > d.right || c.top > d.bottom ? "scroll" == g.overflow || "auto"
== g.overflow || b instanceof f.HTMLBodyElement : !0; | |
| 599 }; | |
| 600 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); | |
| 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; | |
| 603 }; | |
| 604 axs.utils.isAncestor = function(a, b) { | |
| 605 return null == b ? !1 : b === a ? !0 : axs.utils.isAncestor(a, b.parentNode); | |
| 606 }; | |
| 607 axs.utils.overlappingElements = function(a) { | |
| 608 if (axs.utils.elementHasZeroArea(a)) { | |
| 609 return null; | |
| 610 } | |
| 611 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); | |
| 613 if (null != e && e != a && !axs.utils.isAncestor(e, a) && !axs.utils.isAnces
tor(a, e)) { | |
| 614 var f = window.getComputedStyle(e, null); | |
| 615 f && (f = axs.utils.getBgColor(f, e)) && 0 < f.alpha && 0 > b.indexOf(e) &
& b.push(e); | |
| 616 } | |
| 617 } | |
| 618 return b; | |
| 619 }; | |
| 620 axs.utils.elementIsHtmlControl = function(a) { | |
| 621 var b = a.ownerDocument.defaultView; | |
| 622 return a instanceof b.HTMLButtonElement || a instanceof b.HTMLInputElement ||
a instanceof b.HTMLSelectElement || a instanceof b.HTMLTextAreaElement ? !0 : !1
; | |
| 623 }; | |
| 624 axs.utils.elementIsAriaWidget = function(a) { | |
| 625 return a.hasAttribute("role") && (a = a.getAttribute("role")) && (a = axs.cons
tants.ARIA_ROLES[a]) && "widget" in a.allParentRolesSet ? !0 : !1; | |
| 626 }; | |
| 627 axs.utils.elementIsVisible = function(a) { | |
| 628 return axs.utils.elementIsTransparent(a) || axs.utils.elementHasZeroArea(a) ||
axs.utils.elementIsOutsideScrollArea(a) || axs.utils.overlappingElements(a).len
gth ? !1 : !0; | |
| 629 }; | |
| 630 axs.utils.isLargeFont = function(a) { | |
| 631 var b = a.fontSize; | |
| 632 a = "bold" == a.fontWeight; | |
| 633 var c = b.match(/(\d+)px/); | |
| 634 if (c) { | |
| 635 b = parseInt(c[1], 10); | |
| 636 if (c = window.getComputedStyle(document.body, null).fontSize.match(/(\d+)px
/)) { | |
| 637 var d = parseInt(c[1], 10), c = 1.2 * d, d = 1.5 * d | |
| 638 } else { | |
| 639 c = 19.2, d = 24; | |
| 640 } | |
| 641 return a && b >= c || b >= d; | |
| 642 } | |
| 643 if (c = b.match(/(\d+)em/)) { | |
| 644 return b = parseInt(c[1], 10), a && 1.2 <= b || 1.5 <= b ? !0 : !1; | |
| 645 } | |
| 646 if (c = b.match(/(\d+)%/)) { | |
| 647 return b = parseInt(c[1], 10), a && 120 <= b || 150 <= b ? !0 : !1; | |
| 648 } | |
| 649 if (c = b.match(/(\d+)pt/)) { | |
| 650 if (b = parseInt(c[1], 10), a && 14 <= b || 18 <= b) { | |
| 651 return!0; | |
| 652 } | |
| 653 } | |
| 654 return!1; | |
| 655 }; | |
| 656 axs.utils.getBgColor = function(a, b) { | |
| 657 var c = axs.utils.parseColor(a.backgroundColor); | |
| 658 if (!c) { | |
| 659 return null; | |
| 660 } | |
| 661 1 > a.opacity && (c.alpha *= a.opacity); | |
| 662 if (1 > c.alpha) { | |
| 663 var d = axs.utils.getParentBgColor(b); | |
| 664 if (null == d) { | |
| 665 return null; | |
| 666 } | |
| 667 c = axs.utils.flattenColors(c, d); | |
| 668 } | |
| 669 return c; | |
| 670 }; | |
| 671 axs.utils.getParentBgColor = function(a) { | |
| 672 var b = a; | |
| 673 a = []; | |
| 674 for (var c = null;b = axs.utils.parentElement(b);) { | |
| 675 var d = window.getComputedStyle(b, null); | |
| 676 if (d) { | |
| 677 var e = axs.utils.parseColor(d.backgroundColor); | |
| 678 if (e && (1 > d.opacity && (e.alpha *= d.opacity), 0 != e.alpha && (a.push
(e), 1 == e.alpha))) { | |
| 679 c = !0; | |
| 680 break; | |
| 681 } | |
| 682 } | |
| 683 } | |
| 684 c || a.push(new axs.utils.Color(255, 255, 255, 1)); | |
| 685 for (b = a.pop();a.length;) { | |
| 686 c = a.pop(), b = axs.utils.flattenColors(c, b); | |
| 687 } | |
| 688 return b; | |
| 689 }; | |
| 690 axs.utils.getFgColor = function(a, b, c) { | |
| 691 var d = axs.utils.parseColor(a.color); | |
| 692 if (!d) { | |
| 693 return null; | |
| 694 } | |
| 695 1 > d.alpha && (d = axs.utils.flattenColors(d, c)); | |
| 696 1 > a.opacity && (b = axs.utils.getParentBgColor(b), d.alpha *= a.opacity, d =
axs.utils.flattenColors(d, b)); | |
| 697 return d; | |
| 698 }; | |
| 699 axs.utils.parseColor = function(a) { | |
| 700 var b = a.match(/^rgb\((\d+), (\d+), (\d+)\)$/); | |
| 701 if (b) { | |
| 702 a = parseInt(b[1], 10); | |
| 703 var c = parseInt(b[2], 10), d = parseInt(b[3], 10); | |
| 704 return new axs.utils.Color(a, c, d, 1); | |
| 705 } | |
| 706 return(b = a.match(/^rgba\((\d+), (\d+), (\d+), (\d*(\.\d+)?)\)/)) ? (a = pars
eInt(b[1], 10), c = parseInt(b[2], 10), d = parseInt(b[3], 10), b = parseFloat(b
[4]), new axs.utils.Color(a, c, d, b)) : null; | |
| 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) { | |
| 820 var b = window.getComputedStyle(a, null); | |
| 821 return axs.utils.getContrastRatioForElementWithComputedStyle(b, a); | |
| 822 }; | |
| 823 axs.utils.getContrastRatioForElementWithComputedStyle = function(a, b) { | |
| 824 if (axs.utils.isElementHidden(b)) { | |
| 825 return null; | |
| 826 } | |
| 827 var c = axs.utils.getBgColor(a, b); | |
| 828 if (!c) { | |
| 829 return null; | |
| 830 } | |
| 831 var d = axs.utils.getFgColor(a, b, c); | |
| 832 return d ? axs.utils.calculateContrastRatio(d, c) : null; | |
| 833 }; | |
| 834 axs.utils.isNativeTextElement = function(a) { | |
| 835 var b = a.tagName.toLowerCase(); | |
| 836 a = a.type ? a.type.toLowerCase() : ""; | |
| 837 if ("textarea" == b) { | |
| 838 return!0; | |
| 839 } | |
| 840 if ("input" != b) { | |
| 841 return!1; | |
| 842 } | |
| 843 switch(a) { | |
| 844 case "email": | |
| 845 ; | |
| 846 case "number": | |
| 847 ; | |
| 848 case "password": | |
| 849 ; | |
| 850 case "search": | |
| 851 ; | |
| 852 case "text": | |
| 853 ; | |
| 854 case "tel": | |
| 855 ; | |
| 856 case "url": | |
| 857 ; | |
| 858 case "": | |
| 859 return!0; | |
| 860 default: | |
| 861 return!1; | |
| 862 } | |
| 863 }; | |
| 864 axs.utils.isLowContrast = function(a, b, c) { | |
| 865 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; | |
| 867 }; | |
| 868 axs.utils.hasLabel = function(a) { | |
| 869 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) { | |
| 871 return!0; | |
| 872 } | |
| 873 for (b = axs.utils.parentElement(a);b;) { | |
| 874 if ("label" == b.tagName.toLowerCase() && b.control == a) { | |
| 875 return!0; | |
| 876 } | |
| 877 b = axs.utils.parentElement(b); | |
| 878 } | |
| 879 return!1; | |
| 880 }; | |
| 881 axs.utils.isElementHidden = function(a) { | |
| 882 if (!(a instanceof a.ownerDocument.defaultView.HTMLElement)) { | |
| 883 return!1; | |
| 884 } | |
| 885 if (a.hasAttribute("chromevoxignoreariahidden")) { | |
| 886 var b = !0 | |
| 887 } | |
| 888 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
; | |
| 890 }; | |
| 891 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; | |
| 893 }; | |
| 894 axs.utils.isInlineElement = function(a) { | |
| 895 a = a.tagName.toUpperCase(); | |
| 896 return axs.constants.InlineElements[a]; | |
| 897 }; | |
| 898 axs.utils.getRoles = function(a) { | |
| 899 if (!a.hasAttribute("role")) { | |
| 900 return!1; | |
| 901 } | |
| 902 a = a.getAttribute("role").split(" "); | |
| 903 for (var b = [], c = !0, d = 0;d < a.length;d++) { | |
| 904 var e = a[d]; | |
| 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); | |
| 906 } | |
| 907 return{roles:b, valid:c}; | |
| 908 }; | |
| 909 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}; | |
| 911 if (!e) { | |
| 912 return d.valid = !1, d.reason = '"' + a + '" is not a valid ARIA property',
d; | |
| 913 } | |
| 914 e = e.valueType; | |
| 915 if (!e) { | |
| 916 return d.valid = !1, d.reason = '"' + a + '" is not a valid ARIA property',
d; | |
| 917 } | |
| 918 switch(e) { | |
| 919 case "idref": | |
| 920 a = axs.utils.isValidIDRefValue(b, c), d.valid = a.valid, d.reason = a.rea
son, d.idref = a.idref; | |
| 921 case "idref_list": | |
| 922 a = b.split(/\s+/); | |
| 923 d.valid = !0; | |
| 924 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]; | |
| 926 } | |
| 927 return d; | |
| 928 case "integer": | |
| 929 ; | |
| 930 case "decimal": | |
| 931 c = axs.utils.isValidNumber(b); | |
| 932 if (!c.valid) { | |
| 933 return d.valid = !1, d.reason = c.reason, d; | |
| 934 } | |
| 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); | |
| 936 return d; | |
| 937 case "number": | |
| 938 c = axs.utils.isValidNumber(b), c.valid && (d.valid = !0, d.value = c.valu
e); | |
| 939 case "string": | |
| 940 return d.valid = !0, d.value = b, d; | |
| 941 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; | |
| 943 case "token_list": | |
| 944 e = b.split(/\s+/); | |
| 945 d.valid = !0; | |
| 946 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]; | |
| 948 } | |
| 949 return d; | |
| 950 case "tristate": | |
| 951 return c = axs.utils.isPossibleValue(b.toLowerCase(), axs.constants.MIXED_
VALUES, a), c.valid ? (d.valid = !0, d.value = c.value) : (d.valid = !1, d.value
= b, d.reason = c.reason), d; | |
| 952 case "boolean": | |
| 953 return c = axs.utils.isValidBoolean(b), c.valid ? (d.valid = !0, d.value =
c.value) : (d.valid = !1, d.value = b, d.reason = c.reason), d; | |
| 954 } | |
| 955 d.valid = !1; | |
| 956 d.reason = "Not a valid ARIA property"; | |
| 957 return d; | |
| 958 }; | |
| 959 axs.utils.isValidTokenValue = function(a, b) { | |
| 960 var c = a.replace(/^aria-/, ""); | |
| 961 return axs.utils.isPossibleValue(b, axs.constants.ARIA_PROPERTIES[c].valuesSet
, a); | |
| 962 }; | |
| 963 axs.utils.isPossibleValue = function(a, b, c) { | |
| 964 return b[a] ? {valid:!0, value:a} : {valid:!1, value:a, reason:'"' + a + '" is
not a valid value for ' + c, possibleValues:Object.keys(b)}; | |
| 965 }; | |
| 966 axs.utils.isValidBoolean = function(a) { | |
| 967 try { | |
| 968 var b = JSON.parse(a); | |
| 969 } catch (c) { | |
| 970 b = ""; | |
| 971 } | |
| 972 return "boolean" != typeof b ? {valid:!1, value:a, reason:'"' + a + '" is not
a true/false value'} : {valid:!0, value:b}; | |
| 973 }; | |
| 974 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 +
'"'}; | |
| 976 }; | |
| 977 axs.utils.isValidNumber = function(a) { | |
| 978 try { | |
| 979 var b = JSON.parse(a); | |
| 980 } catch (c) { | |
| 981 return{valid:!1, value:a, reason:'"' + a + '" is not a number'}; | |
| 982 } | |
| 983 return "number" != typeof b ? {valid:!1, value:a, reason:'"' + a + '" is not a
number'} : {valid:!0, value:b}; | |
| 984 }; | |
| 985 axs.utils.isElementImplicitlyFocusable = function(a) { | |
| 986 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; | |
| 988 }; | |
| 989 axs.utils.values = function(a) { | |
| 990 var b = [], c; | |
| 991 for (c in a) { | |
| 992 a.hasOwnProperty(c) && "function" != typeof a[c] && b.push(a[c]); | |
| 993 } | |
| 994 return b; | |
| 995 }; | |
| 996 axs.utils.namedValues = function(a) { | |
| 997 var b = {}, c; | |
| 998 for (c in a) { | |
| 999 a.hasOwnProperty(c) && "function" != typeof a[c] && (b[c] = a[c]); | |
| 1000 } | |
| 1001 return b; | |
| 1002 }; | |
| 1003 axs.utils.getQuerySelectorText = function(a) { | |
| 1004 if (null == a || "HTML" == a.tagName) { | |
| 1005 return "html"; | |
| 1006 } | |
| 1007 if ("BODY" == a.tagName) { | |
| 1008 return "body"; | |
| 1009 } | |
| 1010 if (a.hasAttribute) { | |
| 1011 if (a.id) { | |
| 1012 return "#" + a.id; | |
| 1013 } | |
| 1014 if (a.className) { | |
| 1015 for (var b = "", c = 0;c < a.classList.length;c++) { | |
| 1016 b += "." + a.classList[c]; | |
| 1017 } | |
| 1018 var d = 0; | |
| 1019 if (a.parentNode) { | |
| 1020 for (c = 0;c < a.parentNode.children.length;c++) { | |
| 1021 var e = a.parentNode.children[c]; | |
| 1022 axs.browserUtils.matchSelector(e, b) && d++; | |
| 1023 if (e === a) { | |
| 1024 break; | |
| 1025 } | |
| 1026 } | |
| 1027 } else { | |
| 1028 d = 1; | |
| 1029 } | |
| 1030 if (1 == d) { | |
| 1031 return axs.utils.getQuerySelectorText(a.parentNode) + " > " + b; | |
| 1032 } | |
| 1033 } | |
| 1034 if (a.parentNode) { | |
| 1035 b = a.parentNode.children; | |
| 1036 d = 1; | |
| 1037 for (c = 0;b[c] !== a;) { | |
| 1038 b[c].tagName == a.tagName && d++, c++; | |
| 1039 } | |
| 1040 c = ""; | |
| 1041 "BODY" != a.parentNode.tagName && (c = axs.utils.getQuerySelectorText(a.pa
rentNode) + " > "); | |
| 1042 return 1 == d ? c + a.tagName : c + a.tagName + ":nth-of-type(" + d + ")"; | |
| 1043 } | |
| 1044 } else { | |
| 1045 if (a.selectorText) { | |
| 1046 return a.selectorText; | |
| 1047 } | |
| 1048 } | |
| 1049 return ""; | |
| 1050 }; | |
| 1051 axs.properties = {}; | |
| 1052 axs.properties.TEXT_CONTENT_XPATH = './/text()[normalize-space(.)!=""]/parent::*
[name()!="script"]'; | |
| 1053 axs.properties.getFocusProperties = function(a) { | |
| 1054 var b = {}, c = a.getAttribute("tabindex"); | |
| 1055 void 0 != c ? b.tabindex = {value:c, valid:!0} : axs.utils.isElementImplicitly
Focusable(a) && (b.implicitlyFocusable = {value:!0, valid:!0}); | |
| 1056 if (0 == Object.keys(b).length) { | |
| 1057 return null; | |
| 1058 } | |
| 1059 var d = axs.utils.elementIsTransparent(a), e = axs.utils.elementHasZeroArea(a)
, f = axs.utils.elementIsOutsideScrollArea(a), g = axs.utils.overlappingElements
(a); | |
| 1060 if (d || e || f || 0 < g.length) { | |
| 1061 var c = axs.utils.isElementOrAncestorHidden(a), h = {value:!1, valid:c}; | |
| 1062 d && (h.transparent = !0); | |
| 1063 e && (h.zeroArea = !0); | |
| 1064 f && (h.outsideScrollArea = !0); | |
| 1065 g && 0 < g.length && (h.overlappingElements = g); | |
| 1066 d = {value:c, valid:c}; | |
| 1067 c && (d.reason = axs.properties.getHiddenReason(a)); | |
| 1068 h.hidden = d; | |
| 1069 b.visible = h; | |
| 1070 } else { | |
| 1071 b.visible = {value:!0, valid:!0}; | |
| 1072 } | |
| 1073 return b; | |
| 1074 }; | |
| 1075 axs.properties.getHiddenReason = function(a) { | |
| 1076 if (!(a && a instanceof a.ownerDocument.defaultView.HTMLElement)) { | |
| 1077 return null; | |
| 1078 } | |
| 1079 if (a.hasAttribute("chromevoxignoreariahidden")) { | |
| 1080 var b = !0 | |
| 1081 } | |
| 1082 var c = window.getComputedStyle(a, null); | |
| 1083 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)); | |
| 1084 }; | |
| 1085 axs.properties.getColorProperties = function(a) { | |
| 1086 var b = {}; | |
| 1087 (a = axs.properties.getContrastRatioProperties(a)) && (b.contrastRatio = a); | |
| 1088 return 0 == Object.keys(b).length ? null : b; | |
| 1089 }; | |
| 1090 axs.properties.hasDirectTextDescendant = function(a) { | |
| 1091 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()) { | |
| 1092 if (d === a) { | |
| 1093 c = !0; | |
| 1094 break; | |
| 1095 } | |
| 1096 } | |
| 1097 return c; | |
| 1098 }; | |
| 1099 axs.properties.getContrastRatioProperties = function(a) { | |
| 1100 if (!axs.properties.hasDirectTextDescendant(a)) { | |
| 1101 return null; | |
| 1102 } | |
| 1103 var b = {}, c = window.getComputedStyle(a, null), d = axs.utils.getBgColor(c,
a); | |
| 1104 if (!d) { | |
| 1105 return null; | |
| 1106 } | |
| 1107 b.backgroundColor = axs.utils.colorToString(d); | |
| 1108 var e = axs.utils.getFgColor(c, a, d); | |
| 1109 b.foregroundColor = axs.utils.colorToString(e); | |
| 1110 a = axs.utils.getContrastRatioForElementWithComputedStyle(c, a); | |
| 1111 if (!a) { | |
| 1112 return null; | |
| 1113 } | |
| 1114 b.value = a.toFixed(2); | |
| 1115 axs.utils.isLowContrast(a, c) && (b.alert = !0); | |
| 1116 (c = axs.utils.suggestColors(d, e, a, c)) && Object.keys(c).length && (b.sugge
stedColors = c); | |
| 1117 return b; | |
| 1118 }; | |
| 1119 axs.properties.findTextAlternatives = function(a, b, c, d) { | |
| 1120 var e = c || !1; | |
| 1121 c = axs.utils.asElement(a); | |
| 1122 if (!c || !e && !d && axs.utils.isElementOrAncestorHidden(c)) { | |
| 1123 return null; | |
| 1124 } | |
| 1125 if (a.nodeType == Node.TEXT_NODE) { | |
| 1126 return c = {type:"text"}, c.text = a.textContent, c.lastWord = axs.propertie
s.getLastWord(c.text), b.content = c, a.textContent; | |
| 1127 } | |
| 1128 a = null; | |
| 1129 e || (a = axs.properties.getTextFromAriaLabelledby(c, b)); | |
| 1130 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); | |
| 1131 c.hasAttribute("role") && "presentation" == c.getAttribute("role") || (a = axs
.properties.getTextFromHostLanguageAttributes(c, b, a, e)); | |
| 1132 if (e && axs.utils.elementIsHtmlControl(c)) { | |
| 1133 d = c.ownerDocument.defaultView; | |
| 1134 if (c instanceof d.HTMLInputElement) { | |
| 1135 var f = c; | |
| 1136 "text" == f.type && f.value && 0 < f.value.length && (b.controlValue = {te
xt:f.value}); | |
| 1137 "range" == f.type && (b.controlValue = {text:f.value}); | |
| 1138 } | |
| 1139 c instanceof d.HTMLSelectElement && (b.controlValue = {text:c.value}); | |
| 1140 b.controlValue && (d = b.controlValue, a ? d.unused = !0 : a = d.text); | |
| 1141 } | |
| 1142 if (e && axs.utils.elementIsAriaWidget(c)) { | |
| 1143 e = c.getAttribute("role"); | |
| 1144 "textbox" == e && c.textContent && 0 < c.textContent.length && (b.controlVal
ue = {text:c.textContent}); | |
| 1145 if ("slider" == e || "spinbutton" == e) { | |
| 1146 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")}); | |
| 1147 } | |
| 1148 if ("menu" == e) { | |
| 1149 var g = c.querySelectorAll("[role=menuitemcheckbox], [role=menuitemradio]"
); | |
| 1150 d = []; | |
| 1151 for (f = 0;f < g.length;f++) { | |
| 1152 "true" == g[f].getAttribute("aria-checked") && d.push(g[f]); | |
| 1153 } | |
| 1154 if (0 < d.length) { | |
| 1155 g = ""; | |
| 1156 for (f = 0;f < d.length;f++) { | |
| 1157 g += axs.properties.findTextAlternatives(d[f], {}, !0), f < d.length -
1 && (g += ", "); | |
| 1158 } | |
| 1159 b.controlValue = {text:g}; | |
| 1160 } | |
| 1161 } | |
| 1162 if ("combobox" == e || "select" == e) { | |
| 1163 b.controlValue = {text:"TODO"}; | |
| 1164 } | |
| 1165 b.controlValue && (d = b.controlValue, a ? d.unused = !0 : a = d.text); | |
| 1166 } | |
| 1167 d = !0; | |
| 1168 c.hasAttribute("role") && (e = c.getAttribute("role"), (e = axs.constants.ARIA
_ROLES[e]) && (!e.namefrom || 0 > e.namefrom.indexOf("contents")) && (d = !1)); | |
| 1169 (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); | |
| 1170 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); | |
| 1171 return 0 == Object.keys(b).length && null == a ? null : a; | |
| 1172 }; | |
| 1173 axs.properties.getTextFromDescendantContent = function(a) { | |
| 1174 var b = a.childNodes; | |
| 1175 a = []; | |
| 1176 for (var c = 0;c < b.length;c++) { | |
| 1177 var d = axs.properties.findTextAlternatives(b[c], {}, !0); | |
| 1178 d && a.push(d.trim()); | |
| 1179 } | |
| 1180 if (a.length) { | |
| 1181 b = ""; | |
| 1182 for (c = 0;c < a.length;c++) { | |
| 1183 b = [b, a[c]].join(" ").trim(); | |
| 1184 } | |
| 1185 return b; | |
| 1186 } | |
| 1187 return null; | |
| 1188 }; | |
| 1189 axs.properties.getTextFromAriaLabelledby = function(a, b) { | |
| 1190 var c = null; | |
| 1191 if (!a.hasAttribute("aria-labelledby")) { | |
| 1192 return c; | |
| 1193 } | |
| 1194 for (var d = a.getAttribute("aria-labelledby").split(/\s+/), e = {valid:!0}, f
= [], g = [], h = 0;h < d.length;h++) { | |
| 1195 var k = {type:"element"}, m = d[h]; | |
| 1196 k.value = m; | |
| 1197 var l = document.getElementById(m); | |
| 1198 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]}); | |
| 1199 g.push(k); | |
| 1200 } | |
| 1201 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); | |
| 1202 return c; | |
| 1203 }; | |
| 1204 axs.properties.getTextFromHostLanguageAttributes = function(a, b, c, d) { | |
| 1205 if (axs.browserUtils.matchSelector(a, "img")) { | |
| 1206 if (a.hasAttribute("alt")) { | |
| 1207 var e = {type:"string", valid:!0}; | |
| 1208 e.text = a.getAttribute("alt"); | |
| 1209 c ? e.unused = !0 : c = e.text; | |
| 1210 b.alt = e; | |
| 1211 } else { | |
| 1212 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}); | |
| 1213 } | |
| 1214 } | |
| 1215 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) { | |
| 1216 if (a.hasAttribute("id")) { | |
| 1217 d = document.querySelectorAll('label[for="' + a.id + '"]'); | |
| 1218 for (var e = {}, f = [], g = [], h = 0;h < d.length;h++) { | |
| 1219 var k = {type:"element"}, m = d[h], l = axs.properties.findTextAlternati
ves(m, {}, !0); | |
| 1220 l && 0 < l.trim().length && (k.text = l.trim(), g.push(l.trim())); | |
| 1221 k.element = m; | |
| 1222 f.push(k); | |
| 1223 } | |
| 1224 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); | |
| 1225 } | |
| 1226 d = axs.utils.parentElement(a); | |
| 1227 for (e = {};d;) { | |
| 1228 if ("label" == d.tagName.toLowerCase() && (f = d, f.control == a)) { | |
| 1229 e.type = "element"; | |
| 1230 e.text = axs.properties.findTextAlternatives(f, {}, !0); | |
| 1231 e.lastWord = axs.properties.getLastWord(e.text); | |
| 1232 e.element = f; | |
| 1233 break; | |
| 1234 } | |
| 1235 d = axs.utils.parentElement(d); | |
| 1236 } | |
| 1237 e.text && (c ? e.unused = !0 : c = e.text, b.labelWrapped = e); | |
| 1238 Object.keys(b).length || (b.noLabel = !0); | |
| 1239 } | |
| 1240 return c; | |
| 1241 }; | |
| 1242 axs.properties.getLastWord = function(a) { | |
| 1243 if (!a) { | |
| 1244 return null; | |
| 1245 } | |
| 1246 var b = a.lastIndexOf(" ") + 1, c = a.length - 10; | |
| 1247 return a.substring(b > c ? b : c); | |
| 1248 }; | |
| 1249 axs.properties.getTextProperties = function(a) { | |
| 1250 var b = {}; | |
| 1251 a = axs.properties.findTextAlternatives(a, b, !1, !0); | |
| 1252 if (0 == Object.keys(b).length) { | |
| 1253 if (!a) { | |
| 1254 return null; | |
| 1255 } | |
| 1256 b.hasProperties = !1; | |
| 1257 } else { | |
| 1258 b.hasProperties = !0; | |
| 1259 } | |
| 1260 b.computedText = a; | |
| 1261 b.lastWord = axs.properties.getLastWord(a); | |
| 1262 return b; | |
| 1263 }; | |
| 1264 axs.properties.getAriaProperties = function(a) { | |
| 1265 var b = {}, c = axs.properties.getGlobalAriaProperties(a), d; | |
| 1266 for (d in axs.constants.ARIA_PROPERTIES) { | |
| 1267 var e = "aria-" + d; | |
| 1268 if (a.hasAttribute(e)) { | |
| 1269 var f = a.getAttribute(e); | |
| 1270 c[e] = axs.utils.getAriaPropertyValue(e, f, a); | |
| 1271 } | |
| 1272 } | |
| 1273 0 < Object.keys(c).length && (b.properties = axs.utils.values(c)); | |
| 1274 f = axs.utils.getRoles(a); | |
| 1275 if (!f) { | |
| 1276 return Object.keys(b).length ? b : null; | |
| 1277 } | |
| 1278 b.roles = f; | |
| 1279 if (!f.valid || !f.roles) { | |
| 1280 return b; | |
| 1281 } | |
| 1282 for (var e = f.roles, g = 0;g < e.length;g++) { | |
| 1283 var h = e[g]; | |
| 1284 if (h.details && h.details.propertiesSet) { | |
| 1285 for (d in h.details.propertiesSet) { | |
| 1286 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"})); | |
| 1287 } | |
| 1288 } | |
| 1289 } | |
| 1290 0 < Object.keys(c).length && (b.properties = axs.utils.values(c)); | |
| 1291 return 0 < Object.keys(b).length ? b : null; | |
| 1292 }; | |
| 1293 axs.properties.getGlobalAriaProperties = function(a) { | |
| 1294 for (var b = {}, c = 0;c < axs.constants.GLOBAL_PROPERTIES.length;c++) { | |
| 1295 var d = axs.constants.GLOBAL_PROPERTIES[c]; | |
| 1296 if (a.hasAttribute(d)) { | |
| 1297 var e = a.getAttribute(d); | |
| 1298 b[d] = axs.utils.getAriaPropertyValue(d, e, a); | |
| 1299 } | |
| 1300 } | |
| 1301 return b; | |
| 1302 }; | |
| 1303 axs.properties.getVideoProperties = function(a) { | |
| 1304 if (!axs.browserUtils.matchSelector(a, "video")) { | |
| 1305 return null; | |
| 1306 } | |
| 1307 var b = {}; | |
| 1308 b.captionTracks = axs.properties.getTrackElements(a, "captions"); | |
| 1309 b.descriptionTracks = axs.properties.getTrackElements(a, "descriptions"); | |
| 1310 b.chapterTracks = axs.properties.getTrackElements(a, "chapters"); | |
| 1311 return b; | |
| 1312 }; | |
| 1313 axs.properties.getTrackElements = function(a, b) { | |
| 1314 var c = a.querySelectorAll("track[kind=" + b + "]"), d = {}; | |
| 1315 if (!c.length) { | |
| 1316 return d.valid = !1, d.reason = {messageKey:"noTracksProvided", args:[[b]]},
d; | |
| 1317 } | |
| 1318 d.valid = !0; | |
| 1319 for (var e = [], f = 0;f < c.length;f++) { | |
| 1320 var g = {}, h = c[f].getAttribute("src"), k = c[f].getAttribute("srcLang"),
m = c[f].getAttribute("label"); | |
| 1321 h ? (g.valid = !0, g.src = h) : (g.valid = !1, g.reason = {messageKey:"noSrc
Provided"}); | |
| 1322 h = ""; | |
| 1323 m && (h += m, k && (h += " ")); | |
| 1324 k && (h += "(" + k + ")"); | |
| 1325 "" == h && (h = "[[object Object]]"); | |
| 1326 g.name = h; | |
| 1327 e.push(g); | |
| 1328 } | |
| 1329 d.values = e; | |
| 1330 return d; | |
| 1331 }; | |
| 1332 axs.properties.getAllProperties = function(a) { | |
| 1333 var b = axs.utils.asElement(a); | |
| 1334 if (!b) { | |
| 1335 return{}; | |
| 1336 } | |
| 1337 var c = {}; | |
| 1338 c.ariaProperties = axs.properties.getAriaProperties(b); | |
| 1339 c.colorProperties = axs.properties.getColorProperties(b); | |
| 1340 c.focusProperties = axs.properties.getFocusProperties(b); | |
| 1341 c.textProperties = axs.properties.getTextProperties(a); | |
| 1342 c.videoProperties = axs.properties.getVideoProperties(b); | |
| 1343 return c; | |
| 1344 }; | |
| 1345 axs.AuditRule = function(a) { | |
| 1346 for (var b = !0, c = [], d = 0;d < axs.AuditRule.requiredFields.length;d++) { | |
| 1347 var e = axs.AuditRule.requiredFields[d]; | |
| 1348 e in a || (b = !1, c.push(e)); | |
| 1349 } | |
| 1350 if (!b) { | |
| 1351 throw "Invalid spec; the following fields were not specified: " + c.join(",
") + "\n" + JSON.stringify(a); | |
| 1352 } | |
| 1353 this.name = a.name; | |
| 1354 this.severity = a.severity; | |
| 1355 this.relevantElementMatcher_ = a.relevantElementMatcher; | |
| 1356 this.test_ = a.test; | |
| 1357 this.code = a.code; | |
| 1358 this.heading = a.heading || ""; | |
| 1359 this.url = a.url || ""; | |
| 1360 this.requiresConsoleAPI = !!a.opt_requiresConsoleAPI; | |
| 1361 }; | |
| 1362 axs.AuditRule.requiredFields = "name severity relevantElementMatcher test code h
eading".split(" "); | |
| 1363 axs.AuditRule.NOT_APPLICABLE = {result:axs.constants.AuditResult.NA}; | |
| 1364 axs.AuditRule.prototype.addElement = function(a, b) { | |
| 1365 a.push(b); | |
| 1366 }; | |
| 1367 axs.AuditRule.collectMatchingElements = function(a, b, c, d) { | |
| 1368 if (a.nodeType == Node.ELEMENT_NODE) { | |
| 1369 var e = a | |
| 1370 } | |
| 1371 e && b.call(null, e) && c.push(e); | |
| 1372 if (e) { | |
| 1373 var f = e.shadowRoot || e.webkitShadowRoot; | |
| 1374 if (f) { | |
| 1375 axs.AuditRule.collectMatchingElements(f, b, c, f); | |
| 1376 return; | |
| 1377 } | |
| 1378 } | |
| 1379 if (e && "content" == e.localName) { | |
| 1380 for (e = e.getDistributedNodes(), a = 0;a < e.length;a++) { | |
| 1381 axs.AuditRule.collectMatchingElements(e[a], b, c, d); | |
| 1382 } | |
| 1383 } else { | |
| 1384 if (e && "shadow" == e.localName) { | |
| 1385 a = e, d ? (d = d.olderShadowRoot || a.olderShadowRoot) && axs.AuditRule.c
ollectMatchingElements(d, b, c, d) : console.warn("ShadowRoot not provided for",
e); | |
| 1386 } else { | |
| 1387 for (e = a.firstChild;null != e;) { | |
| 1388 axs.AuditRule.collectMatchingElements(e, b, c, d), e = e.nextSibling; | |
| 1389 } | |
| 1390 } | |
| 1391 } | |
| 1392 }; | |
| 1393 axs.AuditRule.prototype.run = function(a) { | |
| 1394 a = a || {}; | |
| 1395 var b = "ignoreSelectors" in a ? a.ignoreSelectors : [], c = "maxResults" in a
? a.maxResults : null, d = []; | |
| 1396 axs.AuditRule.collectMatchingElements("scope" in a ? a.scope : document, this.
relevantElementMatcher_, d); | |
| 1397 var e = []; | |
| 1398 if (!d.length) { | |
| 1399 return{result:axs.constants.AuditResult.NA}; | |
| 1400 } | |
| 1401 for (var f = 0;f < d.length && !(null != c && e.length >= c);f++) { | |
| 1402 var g = d[f], h; | |
| 1403 a: { | |
| 1404 h = g; | |
| 1405 for (var k = 0;k < b.length;k++) { | |
| 1406 if (axs.browserUtils.matchSelector(h, b[k])) { | |
| 1407 h = !0; | |
| 1408 break a; | |
| 1409 } | |
| 1410 } | |
| 1411 h = !1; | |
| 1412 } | |
| 1413 !h && this.test_(g, a.config) && this.addElement(e, g); | |
| 1414 } | |
| 1415 a = {result:e.length ? axs.constants.AuditResult.FAIL : axs.constants.AuditRes
ult.PASS, elements:e}; | |
| 1416 f < d.length && (a.resultsTruncated = !0); | |
| 1417 return a; | |
| 1418 }; | |
| 1419 axs.AuditRule.specs = {}; | |
| 1420 axs.AuditRules = {}; | |
| 1421 axs.AuditRules.getRule = function(a) { | |
| 1422 if (!axs.AuditRules.rules) { | |
| 1423 axs.AuditRules.rules = {}; | |
| 1424 for (var b in axs.AuditRule.specs) { | |
| 1425 var c = axs.AuditRule.specs[b], d = new axs.AuditRule(c); | |
| 1426 axs.AuditRules.rules[c.name] = d; | |
| 1427 } | |
| 1428 } | |
| 1429 return axs.AuditRules.rules[a]; | |
| 1430 }; | |
| 1431 axs.AuditResults = function() { | |
| 1432 this.errors_ = []; | |
| 1433 this.warnings_ = []; | |
| 1434 }; | |
| 1435 goog.exportSymbol("axs.AuditResults", axs.AuditResults); | |
| 1436 axs.AuditResults.prototype.addError = function(a) { | |
| 1437 "" != a && this.errors_.push(a); | |
| 1438 }; | |
| 1439 goog.exportProperty(axs.AuditResults.prototype, "addError", axs.AuditResults.pro
totype.addError); | |
| 1440 axs.AuditResults.prototype.addWarning = function(a) { | |
| 1441 "" != a && this.warnings_.push(a); | |
| 1442 }; | |
| 1443 goog.exportProperty(axs.AuditResults.prototype, "addWarning", axs.AuditResults.p
rototype.addWarning); | |
| 1444 axs.AuditResults.prototype.numErrors = function() { | |
| 1445 return this.errors_.length; | |
| 1446 }; | |
| 1447 goog.exportProperty(axs.AuditResults.prototype, "numErrors", axs.AuditResults.pr
ototype.numErrors); | |
| 1448 axs.AuditResults.prototype.numWarnings = function() { | |
| 1449 return this.warnings_.length; | |
| 1450 }; | |
| 1451 goog.exportProperty(axs.AuditResults.prototype, "numWarnings", axs.AuditResults.
prototype.numWarnings); | |
| 1452 axs.AuditResults.prototype.getErrors = function() { | |
| 1453 return this.errors_; | |
| 1454 }; | |
| 1455 goog.exportProperty(axs.AuditResults.prototype, "getErrors", axs.AuditResults.pr
ototype.getErrors); | |
| 1456 axs.AuditResults.prototype.getWarnings = function() { | |
| 1457 return this.warnings_; | |
| 1458 }; | |
| 1459 goog.exportProperty(axs.AuditResults.prototype, "getWarnings", axs.AuditResults.
prototype.getWarnings); | |
| 1460 axs.AuditResults.prototype.toString = function() { | |
| 1461 for (var a = "", b = 0;b < this.errors_.length;b++) { | |
| 1462 0 == b && (a += "\nErrors:\n"); | |
| 1463 var c = this.errors_[b], a = a + (c + "\n\n"); | |
| 1464 } | |
| 1465 for (b = 0;b < this.warnings_.length;b++) { | |
| 1466 0 == b && (a += "\nWarnings:\n"), c = this.warnings_[b], a += c + "\n\n"; | |
| 1467 } | |
| 1468 return a; | |
| 1469 }; | |
| 1470 goog.exportProperty(axs.AuditResults.prototype, "toString", axs.AuditResults.pro
totype.toString); | |
| 1471 axs.Audit = {}; | |
| 1472 axs.AuditConfiguration = function() { | |
| 1473 this.rules_ = {}; | |
| 1474 this.maxResults = this.auditRulesToIgnore = this.auditRulesToRun = this.scope
= null; | |
| 1475 this.withConsoleApi = !1; | |
| 1476 this.showUnsupportedRulesWarning = !0; | |
| 1477 goog.exportProperty(this, "scope", this.scope); | |
| 1478 goog.exportProperty(this, "auditRulesToRun", this.auditRulesToRun); | |
| 1479 goog.exportProperty(this, "auditRulesToIgnore", this.auditRulesToIgnore); | |
| 1480 goog.exportProperty(this, "withConsoleApi", this.withConsoleApi); | |
| 1481 goog.exportProperty(this, "showUnsupportedRulesWarning", this.showUnsupportedR
ulesWarning); | |
| 1482 }; | |
| 1483 goog.exportSymbol("axs.AuditConfiguration", axs.AuditConfiguration); | |
| 1484 axs.AuditConfiguration.prototype = {ignoreSelectors:function(a, b) { | |
| 1485 a in this.rules_ || (this.rules_[a] = {}); | |
| 1486 "ignore" in this.rules_[a] || (this.rules_[a].ignore = []); | |
| 1487 Array.prototype.push.call(this.rules_[a].ignore, b); | |
| 1488 }, getIgnoreSelectors:function(a) { | |
| 1489 return a in this.rules_ && "ignore" in this.rules_[a] ? this.rules_[a].ignore
: []; | |
| 1490 }, setSeverity:function(a, b) { | |
| 1491 a in this.rules_ || (this.rules_[a] = {}); | |
| 1492 this.rules_[a].severity = b; | |
| 1493 }, getSeverity:function(a) { | |
| 1494 return a in this.rules_ && "severity" in this.rules_[a] ? this.rules_[a].sever
ity : null; | |
| 1495 }, setRuleConfig:function(a, b) { | |
| 1496 a in this.rules_ || (this.rules_[a] = {}); | |
| 1497 this.rules_[a].config = b; | |
| 1498 }, getRuleConfig:function(a) { | |
| 1499 return a in this.rules_ && "config" in this.rules_[a] ? this.rules_[a].config
: null; | |
| 1500 }}; | |
| 1501 goog.exportProperty(axs.AuditConfiguration.prototype, "ignoreSelectors", axs.Aud
itConfiguration.prototype.ignoreSelectors); | |
| 1502 goog.exportProperty(axs.AuditConfiguration.prototype, "getIgnoreSelectors", axs.
AuditConfiguration.prototype.getIgnoreSelectors); | |
| 1503 axs.Audit.unsupportedRulesWarningShown = !1; | |
| 1504 axs.Audit.getRulesCannotRun = function(a) { | |
| 1505 return a.withConsoleApi ? [] : Object.keys(axs.AuditRule.specs).filter(functio
n(a) { | |
| 1506 return axs.AuditRules.getRule(a).requiresConsoleAPI; | |
| 1507 }).map(function(a) { | |
| 1508 return axs.AuditRules.getRule(a).code; | |
| 1509 }); | |
| 1510 }; | |
| 1511 axs.Audit.run = function(a) { | |
| 1512 a = a || new axs.AuditConfiguration; | |
| 1513 var b = a.withConsoleApi, c = [], d; | |
| 1514 d = a.auditRulesToRun && 0 < a.auditRulesToRun.length ? a.auditRulesToRun : Ob
ject.keys(axs.AuditRule.specs); | |
| 1515 if (a.auditRulesToIgnore) { | |
| 1516 for (var e = 0;e < a.auditRulesToIgnore.length;e++) { | |
| 1517 var f = a.auditRulesToIgnore[e]; | |
| 1518 0 > d.indexOf(f) || d.splice(d.indexOf(f), 1); | |
| 1519 } | |
| 1520 } | |
| 1521 !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); | |
| 1522 for (e = 0;e < d.length;e++) { | |
| 1523 var f = d[e], g = axs.AuditRules.getRule(f); | |
| 1524 if (g && !g.disabled && (b || !g.requiresConsoleAPI)) { | |
| 1525 var h = {}, k = a.getIgnoreSelectors(g.name); | |
| 1526 if (0 < k.length || a.scope) { | |
| 1527 h.ignoreSelectors = k; | |
| 1528 } | |
| 1529 k = a.getRuleConfig(g.name); | |
| 1530 null != k && (h.config = k); | |
| 1531 a.scope && (h.scope = a.scope); | |
| 1532 a.maxResults && (h.maxResults = a.maxResults); | |
| 1533 h = g.run.call(g, h); | |
| 1534 g = axs.utils.namedValues(g); | |
| 1535 g.severity = a.getSeverity(f) || g.severity; | |
| 1536 h.rule = g; | |
| 1537 c.push(h); | |
| 1538 } | |
| 1539 } | |
| 1540 return c; | |
| 1541 }; | |
| 1542 goog.exportSymbol("axs.Audit.run", axs.Audit.run); | |
| 1543 axs.Audit.auditResults = function(a) { | |
| 1544 for (var b = new axs.AuditResults, c = 0;c < a.length;c++) { | |
| 1545 var d = a[c]; | |
| 1546 d.result == axs.constants.AuditResult.FAIL && (d.rule.severity == axs.consta
nts.Severity.SEVERE ? b.addError(axs.Audit.accessibilityErrorMessage(d)) : b.add
Warning(axs.Audit.accessibilityErrorMessage(d))); | |
| 1547 } | |
| 1548 return b; | |
| 1549 }; | |
| 1550 goog.exportSymbol("axs.Audit.auditResults", axs.Audit.auditResults); | |
| 1551 axs.Audit.createReport = function(a, b) { | |
| 1552 var c; | |
| 1553 c = "*** Begin accessibility audit results ***\nAn accessibility audit found "
+ axs.Audit.auditResults(a).toString(); | |
| 1554 b && (c += "\nFor more information, please see ", c += b); | |
| 1555 return c += "\n*** End accessibility audit results ***"; | |
| 1556 }; | |
| 1557 goog.exportSymbol("axs.Audit.createReport", axs.Audit.createReport); | |
| 1558 axs.Audit.accessibilityErrorMessage = function(a) { | |
| 1559 for (var b = a.rule.severity == axs.constants.Severity.SEVERE ? "Error: " : "W
arning: ", b = b + (a.rule.code + " (" + a.rule.heading + ") failed on the follo
wing " + (1 == a.elements.length ? "element" : "elements")), b = 1 == a.elements
.length ? b + ":" : b + (" (1 - " + Math.min(5, a.elements.length) + " of " + a.
elements.length + "):"), c = Math.min(a.elements.length, 5), d = 0;d < c;d++) { | |
| 1560 var e = a.elements[d], b = b + "\n"; | |
| 1561 try { | |
| 1562 b += axs.utils.getQuerySelectorText(e); | |
| 1563 } catch (f) { | |
| 1564 b += " tagName:" + e.tagName, b += " id:" + e.id; | |
| 1565 } | |
| 1566 } | |
| 1567 "" != a.rule.url && (b += "\nSee " + a.rule.url + " for more information."); | |
| 1568 return b; | |
| 1569 }; | |
| 1570 goog.exportSymbol("axs.Audit.accessibilityErrorMessage", axs.Audit.accessibility
ErrorMessage); | |
| 1571 axs.AuditRule.specs.audioWithoutControls = {name:"audioWithoutControls", heading
:"Audio elements should have controls", url:"", severity:axs.constants.Severity.
WARNING, relevantElementMatcher:function(a) { | |
| 1572 return axs.browserUtils.matchSelector(a, "audio[autoplay]"); | |
| 1573 }, test:function(a) { | |
| 1574 return!a.querySelectorAll("[controls]").length && 3 < a.duration; | |
| 1575 }, code:"AX_AUDIO_01"}; | |
| 1576 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) { | |
| 1577 var b = "", c; | |
| 1578 for (c in axs.constants.ARIA_PROPERTIES) { | |
| 1579 b += "[aria-" + c + "],"; | |
| 1580 } | |
| 1581 b = b.substring(0, b.length - 1); | |
| 1582 return axs.browserUtils.matchSelector(a, b); | |
| 1583 }, test:function(a) { | |
| 1584 for (var b in axs.constants.ARIA_PROPERTIES) { | |
| 1585 var c = "aria-" + b; | |
| 1586 if (a.hasAttribute(c)) { | |
| 1587 var d = a.getAttribute(c); | |
| 1588 if (!axs.utils.getAriaPropertyValue(c, d, a).valid) { | |
| 1589 return!0; | |
| 1590 } | |
| 1591 } | |
| 1592 } | |
| 1593 return!1; | |
| 1594 }, code:"AX_ARIA_04"}; | |
| 1595 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) { | |
| 1596 return axs.browserUtils.matchSelector(a, "[role]"); | |
| 1597 }, test:function(a) { | |
| 1598 return!axs.utils.getRoles(a).valid; | |
| 1599 }, code:"AX_ARIA_01"}; | |
| 1600 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) { | |
| 1601 if (!axs.browserUtils.matchSelector(a, 'input:not([type="hidden"]):not([disabl
ed]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]),
video:not([disabled])')) { | |
| 1602 return!1; | |
| 1603 } | |
| 1604 if (0 <= a.tabIndex) { | |
| 1605 return!0; | |
| 1606 } | |
| 1607 for (a = axs.utils.parentElement(a);null != a;a = axs.utils.parentElement(a))
{ | |
| 1608 if (axs.utils.elementIsAriaWidget(a)) { | |
| 1609 return!1; | |
| 1610 } | |
| 1611 } | |
| 1612 return!0; | |
| 1613 }, test:function(a) { | |
| 1614 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; | |
| 1615 }, code:"AX_TEXT_01", ruleName:"Controls and media elements should have labels"}
; | |
| 1616 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) { | |
| 1617 if (!axs.browserUtils.matchSelector(a, axs.utils.FOCUSABLE_ELEMENTS_SELECTOR))
{ | |
| 1618 return!1; | |
| 1619 } | |
| 1620 if (0 <= a.tabIndex) { | |
| 1621 return!0; | |
| 1622 } | |
| 1623 for (a = axs.utils.parentElement(a);null != a;a = axs.utils.parentElement(a))
{ | |
| 1624 if (axs.utils.elementIsAriaWidget(a)) { | |
| 1625 return!1; | |
| 1626 } | |
| 1627 } | |
| 1628 return!0; | |
| 1629 }, test:function(a) { | |
| 1630 if (axs.utils.isElementOrAncestorHidden(a)) { | |
| 1631 return!1; | |
| 1632 } | |
| 1633 a.focus(); | |
| 1634 return!axs.utils.elementIsVisible(a); | |
| 1635 }, code:"AX_FOCUS_01"}; | |
| 1636 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) { | |
| 1637 return axs.browserUtils.matchSelector(a, "img") && !axs.utils.isElementOrAnces
torHidden(a); | |
| 1638 }, test:function(a) { | |
| 1639 return!a.hasAttribute("alt") && "presentation" != a.getAttribute("role"); | |
| 1640 }, code:"AX_TEXT_02"}; | |
| 1641 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) { | |
| 1642 return axs.browserUtils.matchSelector(a, "a"); | |
| 1643 }, test:function(a, b) { | |
| 1644 for (var c = b || {}, d = c.blacklistPhrases || [], e = /\s+/, f = 0;f < d.len
gth;f++) { | |
| 1645 var g = "^\\s*" + d[f].trim().replace(e, "\\s*") + "s*[^a-z]$"; | |
| 1646 if ((new RegExp(g, "i")).test(a.textContent)) { | |
| 1647 return!0; | |
| 1648 } | |
| 1649 } | |
| 1650 c = c.stopwords || "click tap go here learn more this page link about".split("
"); | |
| 1651 d = a.textContent; | |
| 1652 d = d.replace(/[^a-zA-Z ]/g, ""); | |
| 1653 for (f = 0;f < c.length;f++) { | |
| 1654 if (d = d.replace(new RegExp("\\b" + c[f] + "\\b", "ig"), ""), "" == d.trim(
)) { | |
| 1655 return!0; | |
| 1656 } | |
| 1657 } | |
| 1658 return!1; | |
| 1659 }, code:"AX_TITLE_01"}; | |
| 1660 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) { | |
| 1661 return axs.properties.hasDirectTextDescendant(a); | |
| 1662 }, test:function(a) { | |
| 1663 var b = window.getComputedStyle(a, null); | |
| 1664 return(a = axs.utils.getContrastRatioForElementWithComputedStyle(b, a)) && axs
.utils.isLowContrast(a, b); | |
| 1665 }, code:"AX_COLOR_01"}; | |
| 1666 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)
{ | |
| 1667 return axs.browserUtils.matchSelector(a, "[role~=main]"); | |
| 1668 }, test:function(a) { | |
| 1669 if (axs.utils.isInlineElement(a)) { | |
| 1670 return!0; | |
| 1671 } | |
| 1672 a = axs.properties.getTextFromDescendantContent(a); | |
| 1673 return!a || 50 > a.length ? !0 : !1; | |
| 1674 }, code:"AX_ARIA_04"}; | |
| 1675 axs.AuditRule.specs.elementsWithMeaningfulBackgroundImage = {name:"elementsWithM
eaningfulBackgroundImage", severity:axs.constants.Severity.WARNING, relevantElem
entMatcher:function(a) { | |
| 1676 return!axs.utils.isElementOrAncestorHidden(a); | |
| 1677 }, 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) { | |
| 1678 if (a.textContent && 0 < a.textContent.length) { | |
| 1679 return!1; | |
| 1680 } | |
| 1681 a = window.getComputedStyle(a, null); | |
| 1682 var b = a.backgroundImage; | |
| 1683 if (!b || "undefined" === b || "none" === b || 0 != b.indexOf("url")) { | |
| 1684 return!1; | |
| 1685 } | |
| 1686 b = parseInt(a.width, 10); | |
| 1687 a = parseInt(a.height, 10); | |
| 1688 return 150 > b && 150 > a; | |
| 1689 }, code:"AX_IMAGE_01"}; | |
| 1690 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) { | |
| 1691 return axs.browserUtils.matchSelector(a, "[aria-labelledby]"); | |
| 1692 }, test:function(a) { | |
| 1693 a = a.getAttribute("aria-labelledby").split(/\s+/); | |
| 1694 for (var b = 0;b < a.length;b++) { | |
| 1695 if (!document.getElementById(a[b])) { | |
| 1696 return!0; | |
| 1697 } | |
| 1698 } | |
| 1699 return!1; | |
| 1700 }, code:"AX_ARIA_02"}; | |
| 1701 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) { | |
| 1702 return "html" == a.tagName.toLowerCase(); | |
| 1703 }, test:function(a) { | |
| 1704 a = a.querySelector("head"); | |
| 1705 return a ? (a = a.querySelector("title")) ? !a.textContent : !0 : !0; | |
| 1706 }, code:"AX_TITLE_01"}; | |
| 1707 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) { | |
| 1708 return axs.browserUtils.matchSelector(a, "[role]"); | |
| 1709 }, test:function(a) { | |
| 1710 var b = axs.utils.getRoles(a); | |
| 1711 if (!b.valid) { | |
| 1712 return!1; | |
| 1713 } | |
| 1714 for (var c = 0;c < b.roles.length;c++) { | |
| 1715 var d = b.roles[c].details.requiredPropertiesSet, e; | |
| 1716 for (e in d) { | |
| 1717 if (d = e.replace(/^aria-/, ""), !("defaultValue" in axs.constants.ARIA_PR
OPERTIES[d] || a.hasAttribute(e))) { | |
| 1718 return!0; | |
| 1719 } | |
| 1720 } | |
| 1721 } | |
| 1722 }, code:"AX_ARIA_03"}; | |
| 1723 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) { | |
| 1724 return a instanceof a.ownerDocument.defaultView.HTMLBodyElement || axs.utils.i
sElementOrAncestorHidden(a) ? !1 : "click" in getEventListeners(a) ? !0 : !1; | |
| 1725 }, test:function(a) { | |
| 1726 return!a.hasAttribute("tabindex") && !axs.utils.isElementImplicitlyFocusable(a
) && !a.disabled; | |
| 1727 }, code:"AX_FOCUS_02"}; | |
| 1728 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) { | |
| 1729 return axs.browserUtils.matchSelector(a, "video"); | |
| 1730 }, test:function(a) { | |
| 1731 return!a.querySelectorAll("track[kind=captions]").length; | |
| 1732 }, code:"AX_VIDEO_01"}; | |
| OLD | NEW |