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/tree/3d4893b4ecd0eb8f4765e04479213d04b240f3e0 17 * 18 * See project README for build steps. 19 */ 20 21 // AUTO-GENERATED CONTENT BELOW: DO NOT EDIT! See above for details. 22 23 var COMPILED = !0, goog = goog || {}; 24 goog.global = this; 25 goog.isDef = function(a) { 26 return void 0 !== a; 27 }; 28 goog.exportPath_ = function(a, b, c) { 29 a = a.split("."); 30 c = c || goog.global; 31 a[0] in c || !c.execScript || c.execScript("var " + a[0]); 32 for (var d;a.length && (d = a.shift());) { 33 !a.length && goog.isDef(b) ? c[d] = b : c = c[d] ? c[d] : c[d] = {}; 34 } 35 }; 36 goog.define = function(a, b) { 37 var c = b; 38 COMPILED || (goog.global.CLOSURE_UNCOMPILED_DEFINES && Object.prototype.hasOwnProperty.call(goog.global.CLOSURE_UNCOMPILED_DEFINES, a) ? c = goog.global.CLOSURE_UNCOMPILED_DEFINES[a] : goog.global.CLOSURE_DEFINES && Object.prototype.hasOwnProperty.call(goog.global.CLOSURE_DEFINES, a) && (c = goog.global.CLOSURE_DEFINES[a])); 39 goog.exportPath_(a, c); 40 }; 41 goog.DEBUG = !0; 42 goog.LOCALE = "en"; 43 goog.TRUSTED_SITE = !0; 44 goog.STRICT_MODE_COMPATIBLE = !1; 45 goog.provide = function(a) { 46 if (!COMPILED) { 47 if (goog.isProvided_(a)) { 48 throw Error('Namespace "' + a + '" already declared.'); 49 } 50 delete goog.implicitNamespaces_[a]; 51 for (var b = a;(b = b.substring(0, b.lastIndexOf("."))) && !goog.getObjectByName(b);) { 52 goog.implicitNamespaces_[b] = !0; 53 } 54 } 55 goog.exportPath_(a); 56 }; 57 goog.setTestOnly = function(a) { 58 if (COMPILED && !goog.DEBUG) { 59 throw a = a || "", Error("Importing test-only code into non-debug environment" + a ? ": " + a : "."); 60 } 61 }; 62 goog.forwardDeclare = function(a) { 63 }; 64 COMPILED || (goog.isProvided_ = function(a) { 65 return!goog.implicitNamespaces_[a] && goog.isDefAndNotNull(goog.getObjectByName(a)); 66 }, goog.implicitNamespaces_ = {}); 67 goog.getObjectByName = function(a, b) { 68 for (var c = a.split("."), d = b || goog.global, e;e = c.shift();) { 69 if (goog.isDefAndNotNull(d[e])) { 70 d = d[e]; 71 } else { 72 return null; 73 } 74 } 75 return d; 76 }; 77 goog.globalize = function(a, b) { 78 var c = b || goog.global, d; 79 for (d in a) { 80 c[d] = a[d]; 81 } 82 }; 83 goog.addDependency = function(a, b, c) { 84 if (goog.DEPENDENCIES_ENABLED) { 85 var d; 86 a = a.replace(/\\/g, "/"); 87 for (var e = goog.dependencies_, f = 0;d = b[f];f++) { 88 e.nameToPath[d] = a, a in e.pathToNames || (e.pathToNames[a] = {}), e.pathToNames[a][d] = !0; 89 } 90 for (d = 0;b = c[d];d++) { 91 a in e.requires || (e.requires[a] = {}), e.requires[a][b] = !0; 92 } 93 } 94 }; 95 goog.ENABLE_DEBUG_LOADER = !0; 96 goog.require = function(a) { 97 if (!COMPILED && !goog.isProvided_(a)) { 98 if (goog.ENABLE_DEBUG_LOADER) { 99 var b = goog.getPathFromDeps_(a); 100 if (b) { 101 goog.included_[b] = !0; 102 goog.writeScripts_(); 103 return; 104 } 105 } 106 a = "goog.require could not find: " + a; 107 goog.global.console && goog.global.console.error(a); 108 throw Error(a); 109 } 110 }; 111 goog.basePath = ""; 112 goog.nullFunction = function() { 113 }; 114 goog.identityFunction = function(a, b) { 115 return a; 116 }; 117 goog.abstractMethod = function() { 118 throw Error("unimplemented abstract method"); 119 }; 120 goog.addSingletonGetter = function(a) { 121 a.getInstance = function() { 122 if (a.instance_) { 123 return a.instance_; 124 } 125 goog.DEBUG && (goog.instantiatedSingletons_[goog.instantiatedSingletons_.length] = a); 126 return a.instance_ = new a; 127 }; 128 }; 129 goog.instantiatedSingletons_ = []; 130 goog.DEPENDENCIES_ENABLED = !COMPILED && goog.ENABLE_DEBUG_LOADER; 131 goog.DEPENDENCIES_ENABLED && (goog.included_ = {}, goog.dependencies_ = {pathToNames:{}, nameToPath:{}, requires:{}, visited:{}, written:{}}, goog.inHtmlDocument_ = function() { 132 var a = goog.global.document; 133 return "undefined" != typeof a && "write" in a; 134 }, goog.findBasePath_ = function() { 135 if (goog.global.CLOSURE_BASE_PATH) { 136 goog.basePath = goog.global.CLOSURE_BASE_PATH; 137 } else { 138 if (goog.inHtmlDocument_()) { 139 for (var a = goog.global.document.getElementsByTagName("script"), b = a.length - 1;0 <= b;--b) { 140 var c = a[b].src, d = c.lastIndexOf("?"), d = -1 == d ? c.length : d; 141 if ("base.js" == c.substr(d - 7, 7)) { 142 goog.basePath = c.substr(0, d - 7); 143 break; 144 } 145 } 146 } 147 } 148 }, goog.importScript_ = function(a) { 149 var b = goog.global.CLOSURE_IMPORT_SCRIPT || goog.writeScriptTag_; 150 !goog.dependencies_.written[a] && b(a) && (goog.dependencies_.written[a] = !0); 151 }, goog.writeScriptTag_ = function(a) { 152 if (goog.inHtmlDocument_()) { 153 var b = goog.global.document; 154 if ("complete" == b.readyState) { 155 if (/\bdeps.js$/.test(a)) { 156 return!1; 157 } 158 throw Error('Cannot write "' + a + '" after document load'); 159 } 160 b.write('<script type="text/javascript" src="' + a + '">\x3c/script>'); 161 return!0; 162 } 163 return!1; 164 }, goog.writeScripts_ = function() { 165 function a(e) { 166 if (!(e in d.written)) { 167 if (!(e in d.visited) && (d.visited[e] = !0, e in d.requires)) { 168 for (var g in d.requires[e]) { 169 if (!goog.isProvided_(g)) { 170 if (g in d.nameToPath) { 171 a(d.nameToPath[g]); 172 } else { 173 throw Error("Undefined nameToPath for " + g); 174 } 175 } 176 } 177 } 178 e in c || (c[e] = !0, b.push(e)); 179 } 180 } 181 var b = [], c = {}, d = goog.dependencies_, e; 182 for (e in goog.included_) { 183 d.written[e] || a(e); 184 } 185 for (e = 0;e < b.length;e++) { 186 if (b[e]) { 187 goog.importScript_(goog.basePath + b[e]); 188 } else { 189 throw Error("Undefined script input"); 190 } 191 } 192 }, goog.getPathFromDeps_ = function(a) { 193 return a in goog.dependencies_.nameToPath ? goog.dependencies_.nameToPath[a] : null; 194 }, goog.findBasePath_(), goog.global.CLOSURE_NO_DEPS || goog.importScript_(goog.basePath + "deps.js")); 195 goog.typeOf = function(a) { 196 var b = typeof a; 197 if ("object" == b) { 198 if (a) { 199 if (a instanceof Array) { 200 return "array"; 201 } 202 if (a instanceof Object) { 203 return b; 204 } 205 var c = Object.prototype.toString.call(a); 206 if ("[object Window]" == c) { 207 return "object"; 208 } 209 if ("[object Array]" == c || "number" == typeof a.length && "undefined" != typeof a.splice && "undefined" != typeof a.propertyIsEnumerable && !a.propertyIsEnumerable("splice")) { 210 return "array"; 211 } 212 if ("[object Function]" == c || "undefined" != typeof a.call && "undefined" != typeof a.propertyIsEnumerable && !a.propertyIsEnumerable("call")) { 213 return "function"; 214 } 215 } else { 216 return "null"; 217 } 218 } else { 219 if ("function" == b && "undefined" == typeof a.call) { 220 return "object"; 221 } 222 } 223 return b; 224 }; 225 goog.isNull = function(a) { 226 return null === a; 227 }; 228 goog.isDefAndNotNull = function(a) { 229 return null != a; 230 }; 231 goog.isArray = function(a) { 232 return "array" == goog.typeOf(a); 233 }; 234 goog.isArrayLike = function(a) { 235 var b = goog.typeOf(a); 236 return "array" == b || "object" == b && "number" == typeof a.length; 237 }; 238 goog.isDateLike = function(a) { 239 return goog.isObject(a) && "function" == typeof a.getFullYear; 240 }; 241 goog.isString = function(a) { 242 return "string" == typeof a; 243 }; 244 goog.isBoolean = function(a) { 245 return "boolean" == typeof a; 246 }; 247 goog.isNumber = function(a) { 248 return "number" == typeof a; 249 }; 250 goog.isFunction = function(a) { 251 return "function" == goog.typeOf(a); 252 }; 253 goog.isObject = function(a) { 254 var b = typeof a; 255 return "object" == b && null != a || "function" == b; 256 }; 257 goog.getUid = function(a) { 258 return a[goog.UID_PROPERTY_] || (a[goog.UID_PROPERTY_] = ++goog.uidCounter_); 259 }; 260 goog.hasUid = function(a) { 261 return!!a[goog.UID_PROPERTY_]; 262 }; 263 goog.removeUid = function(a) { 264 "removeAttribute" in a && a.removeAttribute(goog.UID_PROPERTY_); 265 try { 266 delete a[goog.UID_PROPERTY_]; 267 } catch (b) { 268 } 269 }; 270 goog.UID_PROPERTY_ = "closure_uid_" + (1E9 * Math.random() >>> 0); 271 goog.uidCounter_ = 0; 272 goog.getHashCode = goog.getUid; 273 goog.removeHashCode = goog.removeUid; 274 goog.cloneObject = function(a) { 275 var b = goog.typeOf(a); 276 if ("object" == b || "array" == b) { 277 if (a.clone) { 278 return a.clone(); 279 } 280 var b = "array" == b ? [] : {}, c; 281 for (c in a) { 282 b[c] = goog.cloneObject(a[c]); 283 } 284 return b; 285 } 286 return a; 287 }; 288 goog.bindNative_ = function(a, b, c) { 289 return a.call.apply(a.bind, arguments); 290 }; 291 goog.bindJs_ = function(a, b, c) { 292 if (!a) { 293 throw Error(); 294 } 295 if (2 < arguments.length) { 296 var d = Array.prototype.slice.call(arguments, 2); 297 return function() { 298 var c = Array.prototype.slice.call(arguments); 299 Array.prototype.unshift.apply(c, d); 300 return a.apply(b, c); 301 }; 302 } 303 return function() { 304 return a.apply(b, arguments); 305 }; 306 }; 307 goog.bind = function(a, b, c) { 308 Function.prototype.bind && -1 != Function.prototype.bind.toString().indexOf("native code") ? goog.bind = goog.bindNative_ : goog.bind = goog.bindJs_; 309 return goog.bind.apply(null, arguments); 310 }; 311 goog.partial = function(a, b) { 312 var c = Array.prototype.slice.call(arguments, 1); 313 return function() { 314 var b = c.slice(); 315 b.push.apply(b, arguments); 316 return a.apply(this, b); 317 }; 318 }; 319 goog.mixin = function(a, b) { 320 for (var c in b) { 321 a[c] = b[c]; 322 } 323 }; 324 goog.now = goog.TRUSTED_SITE && Date.now || function() { 325 return+new Date; 326 }; 327 goog.globalEval = function(a) { 328 if (goog.global.execScript) { 329 goog.global.execScript(a, "JavaScript"); 330 } else { 331 if (goog.global.eval) { 332 if (null == goog.evalWorksForGlobals_ && (goog.global.eval("var _et_ = 1;"), "undefined" != typeof goog.global._et_ ? (delete goog.global._et_, goog.evalWorksForGlobals_ = !0) : goog.evalWorksForGlobals_ = !1), goog.evalWorksForGlobals_) { 333 goog.global.eval(a); 334 } else { 335 var b = goog.global.document, c = b.createElement("script"); 336 c.type = "text/javascript"; 337 c.defer = !1; 338 c.appendChild(b.createTextNode(a)); 339 b.body.appendChild(c); 340 b.body.removeChild(c); 341 } 342 } else { 343 throw Error("goog.globalEval not available"); 344 } 345 } 346 }; 347 goog.evalWorksForGlobals_ = null; 348 goog.getCssName = function(a, b) { 349 var c = function(a) { 350 return goog.cssNameMapping_[a] || a; 351 }, d = function(a) { 352 a = a.split("-"); 353 for (var b = [], d = 0;d < a.length;d++) { 354 b.push(c(a[d])); 355 } 356 return b.join("-"); 357 }, d = goog.cssNameMapping_ ? "BY_WHOLE" == goog.cssNameMappingStyle_ ? c : d : function(a) { 358 return a; 359 }; 360 return b ? a + "-" + d(b) : d(a); 361 }; 362 goog.setCssNameMapping = function(a, b) { 363 goog.cssNameMapping_ = a; 364 goog.cssNameMappingStyle_ = b; 365 }; 366 !COMPILED && goog.global.CLOSURE_CSS_NAME_MAPPING && (goog.cssNameMapping_ = goog.global.CLOSURE_CSS_NAME_MAPPING); 367 goog.getMsg = function(a, b) { 368 var c = b || {}, d; 369 for (d in c) { 370 var e = ("" + c[d]).replace(/\$/g, "$$$$"); 371 a = a.replace(new RegExp("\\{\\$" + d + "\\}", "gi"), e); 372 } 373 return a; 374 }; 375 goog.getMsgWithFallback = function(a, b) { 376 return a; 377 }; 378 goog.exportSymbol = function(a, b, c) { 379 goog.exportPath_(a, b, c); 380 }; 381 goog.exportProperty = function(a, b, c) { 382 a[b] = c; 383 }; 384 goog.inherits = function(a, b) { 385 function c() { 386 } 387 c.prototype = b.prototype; 388 a.superClass_ = b.prototype; 389 a.prototype = new c; 390 a.prototype.constructor = a; 391 a.base = function(a, c, f) { 392 var g = Array.prototype.slice.call(arguments, 2); 393 return b.prototype[c].apply(a, g); 394 }; 395 }; 396 goog.base = function(a, b, c) { 397 var d = arguments.callee.caller; 398 if (goog.STRICT_MODE_COMPATIBLE || goog.DEBUG && !d) { 399 throw Error("arguments.caller not defined. goog.base() cannot be used with strict mode code. See http://www.ecma-international.org/ecma-262/5.1/#sec-C"); 400 } 401 if (d.superClass_) { 402 return d.superClass_.constructor.apply(a, Array.prototype.slice.call(arguments, 1)); 403 } 404 for (var e = Array.prototype.slice.call(arguments, 2), f = !1, g = a.constructor;g;g = g.superClass_ && g.superClass_.constructor) { 405 if (g.prototype[b] === d) { 406 f = !0; 407 } else { 408 if (f) { 409 return g.prototype[b].apply(a, e); 410 } 411 } 412 } 413 if (a[b] === d) { 414 return a.constructor.prototype[b].apply(a, e); 415 } 416 throw Error("goog.base called from a method of one name to a method of a different name"); 417 }; 418 goog.scope = function(a) { 419 a.call(goog.global); 420 }; 421 var axs = {}; 422 axs.browserUtils = {}; 423 axs.browserUtils.matchSelector = function(a, b) { 424 return a.webkitMatchesSelector ? a.webkitMatchesSelector(b) : a.mozMatchesSelector ? a.mozMatchesSelector(b) : !1; 425 }; 426 axs.constants = {}; 427 axs.constants.ARIA_ROLES = {alert:{namefrom:["author"], parent:["region"]}, alertdialog:{namefrom:["author"], namerequired:!0, parent:["alert", "dialog"]}, application:{namefrom:["author"], namerequired:!0, parent:["landmark"]}, article:{namefrom:["author"], parent:["document", "region"]}, banner:{namefrom:["author"], parent:["landmark"]}, button:{childpresentational:!0, namefrom:["contents", "author"], namerequired:!0, parent:["command"], properties:["aria-expanded", "aria-pressed"]}, checkbox:{namefrom:["contents", 428 "author"], namerequired:!0, parent:["input"], requiredProperties:["aria-checked"], properties:["aria-checked"]}, columnheader:{namefrom:["contents", "author"], namerequired:!0, parent:["gridcell", "sectionhead", "widget"], properties:["aria-sort"]}, combobox:{mustcontain:["listbox", "textbox"], namefrom:["author"], namerequired:!0, parent:["select"], requiredProperties:["aria-expanded"], properties:["aria-expanded", "aria-autocomplete", "aria-required"]}, command:{"abstract":!0, namefrom:["author"], 429 parent:["widget"]}, complementary:{namefrom:["author"], parent:["landmark"]}, composite:{"abstract":!0, childpresentational:!1, namefrom:["author"], parent:["widget"], properties:["aria-activedescendant"]}, contentinfo:{namefrom:["author"], parent:["landmark"]}, definition:{namefrom:["author"], parent:["section"]}, dialog:{namefrom:["author"], namerequired:!0, parent:["window"]}, directory:{namefrom:["contents", "author"], parent:["list"]}, document:{namefrom:[" author"], namerequired:!0, parent:["structure"], 430 properties:["aria-expanded"]}, form:{namefrom:["author"], parent:["landmark"]}, grid:{mustcontain:["row", "rowgroup"], namefrom:["author"], namerequired:!0, parent:["composite", "region"], properties:["aria-level", "aria-multiselectable", "aria-readonly"]}, gridcell:{namefrom:["contents", "author"], namerequired:!0, parent:["section", "widget"], properties:["aria-readonly", "aria-required", "aria-selected"]}, group:{namefrom:[" author"], parent:["section"], properties:["aria-activedescendant"]}, 431 heading:{namerequired:!0, parent:["sectionhead"], properties:["aria-level"]}, img:{childpresentational:!0, namefrom:["author"], namerequired:!0, parent:["section"]}, input:{"abstract":!0, namefrom:["author"], parent:["widget"]}, landmark:{"abstract":!0, namefrom:["contents", "author"], namerequired:!1, parent:["region"]}, link:{namefrom:["contents", "author"], namerequired:!0, parent:["command"], properties:["aria-expanded"]}, list:{mustcontain:["group", "listitem"], namefrom:["author"], parent:["region"]}, 432 listbox:{mustcontain:["option"], namefrom:["author"], namerequired:!0, parent:["list", "select"], properties:["aria-multiselectable", "aria-required"]}, listitem:{namefrom:["contents", "author"], namerequired:!0, parent:["section"], properties:["aria-level", "aria-posinset", "aria-setsize"]}, log:{namefrom:[" author"], namerequired:!0, parent:["region"]}, main:{namefrom:["author"], parent:["landmark"]}, marquee:{namerequired:!0, parent:["section"]}, math:{childpresentational:!0, namefrom:["author"], 433 parent:["section"]}, menu:{mustcontain:["group", "menuitemradio", "menuitem", "menuitemcheckbox"], namefrom:["author"], namerequired:!0, parent:["list", "select"]}, menubar:{namefrom:["author"], parent:["menu"]}, menuitem:{namefrom:["contents", "author"], namerequired:!0, parent:["command"]}, menuitemcheckbox:{namefrom:["contents", "author"], namerequired:!0, parent:["checkbox", "menuitem"]}, menuitemradio:{namefrom:["contents", "author"], namerequired:!0, parent:["menuitemcheckbox", "radio"]}, navigation:{namefrom:["author"], 434 parent:["landmark"]}, note:{namefrom:["author"], parent:["section"]}, option:{namefrom:["contents", "author"], namerequired:!0, parent:["input"], properties:["aria-checked", "aria-posinset", "aria-selected", "aria-setsize"]}, presentation:{parent:["structure"]}, progressbar:{childpresentational:!0, namefrom:["author"], namerequired:!0, parent:["range"]}, radio:{namefrom:["contents", "author"], namerequired:!0, parent:["checkbox", "option"]}, radiogroup:{mustcontain:["radio"], namefrom:["author"], 435 namerequired:!0, parent:["select"], properties:["aria-required"]}, range:{"abstract":!0, namefrom:["author"], parent:["widget"], properties:["aria-valuemax", "aria-valuemin", "aria-valuenow", "aria-valuetext"]}, region:{namefrom:[" author"], parent:["section"]}, roletype:{"abstract":!0, properties:"aria-atomic aria-busy aria-controls aria-describedby aria-disabled aria-dropeffect aria-flowto aria-grabbed aria-haspopup aria-hidden aria-invalid aria-label aria-labelledby aria-live aria-owns aria-relevant".split(" ")}, 436 row:{mustcontain:["columnheader", "gridcell", "rowheader"], namefrom:["contents", "author"], parent:["group", "widget"], properties:["aria-level", "aria-selected"]}, rowgroup:{mustcontain:["row"], namefrom:["contents", "author"], parent:["group"]}, rowheader:{namefrom:["contents", "author"], namerequired:!0, parent:["gridcell", "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:{"abstract":!0, namefrom:["author"], parent:["composite", "group", "input"]}, separator:{childpresentational:!0, namefrom:["author"], parent:["structure"], properties:["aria-expanded", "aria-orientation"]}, scrollbar:{childpresentational:!0, namefrom:["author"], namerequired:!1, 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-orientation"]}, spinbutton:{namefrom:["author"], namerequired:!0, parent:["input", "range"], requiredProperties:["aria-valuemax", 439 "aria-valuemin", "aria-valuenow"], properties:["aria-valuemax", "aria-valuemin", "aria-valuenow", "aria-required"]}, status:{parent:["region"]}, structure:{"abstract":!0, parent:["roletype"]}, tab:{namefrom:["contents", "author"], parent:["sectionhead", "widget"], properties:["aria-selected"]}, tablist:{mustcontain:["tab"], namefrom:["author"], parent:["composite", "directory"], properties:["aria-level"]}, tabpanel:{namefrom:["author"], namerequired:!0, parent:["region"]}, textbox:{namefrom:["author"], 440 namerequired:!0, parent:["input"], properties:["aria-activedescendant", "aria-autocomplete", "aria-multiline", "aria-readonly", "aria-required"]}, timer:{namefrom:["author"], namerequired:!0, parent:["status"]}, toolbar:{namefrom:["author"], parent:["group"]}, tooltip:{namerequired:!0, parent:["section"]}, tree:{mustcontain:["group", "treeitem"], namefrom:["author"], namerequired:!0, parent:["select"], properties:["aria-multiselectable", "aria-required"]}, treegrid:{mustcontain:["row"], namefrom:["author"], 441 namerequired:!0, parent:["grid", "tree"]}, treeitem:{namefrom:["contents", "author"], namerequired:!0, parent:["listitem", "option"]}, widget:{"abstract":!0, parent:["roletype"]}, window:{"abstract":!0, namefrom:[" author"], parent:["roletype"], properties:["aria-expanded"]}}; 442 axs.constants.WIDGET_ROLES = {}; 443 axs.constants.addAllParentRolesToSet_ = function(a, b) { 444 if (a.parent) { 445 for (var c = a.parent, d = 0;d < c.length;d++) { 446 var e = c[d]; 447 b[e] = !0; 448 axs.constants.addAllParentRolesToSet_(axs.constants.ARIA_ROLES[e], b); 449 } 450 } 451 }; 452 axs.constants.addAllPropertiesToSet_ = function(a, b, c) { 453 var d = a[b]; 454 if (d) { 455 for (var e = 0;e < d.length;e++) { 456 c[d[e]] = !0; 457 } 458 } 459 if (a.parent) { 460 for (a = a.parent, d = 0;d < a.length;d++) { 461 axs.constants.addAllPropertiesToSet_(axs.constants.ARIA_ROLES[a[d]], b, c); 462 } 463 } 464 }; 465 for (var roleName in axs.constants.ARIA_ROLES) { 466 var role = axs.constants.ARIA_ROLES[roleName], propertiesSet = {}; 467 axs.constants.addAllPropertiesToSet_(role, "properties", propertiesSet); 468 role.propertiesSet = propertiesSet; 469 var requiredPropertiesSet = {}; 470 axs.constants.addAllPropertiesToSet_(role, "requiredProperties", requiredPropertiesSet); 471 role.requiredPropertiesSet = requiredPropertiesSet; 472 var parentRolesSet = {}; 473 axs.constants.addAllParentRolesToSet_(role, parentRolesSet); 474 role.allParentRolesSet = parentRolesSet; 475 "widget" in parentRolesSet && (axs.constants.WIDGET_ROLES[roleName] = role); 476 } 477 axs.constants.ARIA_PROPERTIES = {activedescendant:{type:"property", valueType:"idref"}, atomic:{defaultValue:"false", type:"property", valueType:"boolean"}, autocomplete:{defaultValue:"none", type:"property", valueType:"token", values:["inline", "list", "both", "none"]}, busy:{defaultValue:"false", type:"state", valueType:"boolean"}, checked:{defaultValue:"undefined", type:"state", valueType:"token", values:["true", "false", "mixed", "undefined"]}, controls:{type:"property", valueType:"idref_list"}, 478 describedby:{type:"property", valueType:"idref_list"}, disabled:{defaultValue:"false", type:"state", valueType:"boolean"}, dropeffect:{defaultValue:"none", type:"property", valueType:"token_list", values:"copy move link execute popup none".split(" ")}, expanded:{defaultValue:"undefined", type:"state", valueType:"token", values:["true", "false", "undefined"]}, flowto:{type:"property", valueType:"idref_list"}, grabbed:{defaultValue:"undefined", type:"state", valueType:"token", values:["true", "false", 479 "undefined"]}, haspopup:{defaultValue:"false", type:"property", valueType:"boolean"}, hidden:{defaultValue:"false", type:"state", valueType:"boolean"}, invalid:{defaultValue:"false", type:"state", valueType:"token", values:["grammar", "false", "spelling", "true"]}, label:{type:"property", valueType:"string"}, labelledby:{type:"property", valueType:"idref_list"}, level:{type:"property", valueType:"integer"}, live:{defaultValue:"off", type:"property", valueType:"token", values:["off", "polite", "assertive"]}, 480 multiline:{defaultValue:"false", type:"property", valueType:"boolean"}, multiselectable:{defaultValue:"false", type:"property", valueType:"boolean"}, orientation:{defaultValue:"vertical", type:"property", valueType:"token", values:["horizontal", "vertical"]}, owns:{type:"property", valueType:"idref_list"}, posinset:{type:"property", valueType:"integer"}, pressed:{defaultValue:"undefined", type:"state", valueType:"token", values:["true", "false", "mixed", "undefined"]}, readonly:{defaultValue:"false", 481 type:"property", valueType:"boolean"}, relevant:{defaultValue:"additions text", type:"property", valueType:"token_list", values:["additions", "removals", "text", "all"]}, required:{defaultValue:"false", type:"property", valueType:"boolean"}, selected:{defaultValue:"undefined", type:"state", valueType:"token", values:["true", "false", "undefined"]}, setsize:{type:"property", valueType:"integer"}, sort:{defaultValue:"none", type:"property", valueType:"token", values:["ascending", "descending", "none", 482 "other"]}, valuemax:{type:"property", valueType:"decimal"}, valuemin:{type:"property", valueType:"decimal"}, valuenow:{type:"property", valueType:"decimal"}, valuetext:{type:"property", valueType:"string"}}; 483 axs.constants.GLOBAL_PROPERTIES = "aria-atomic aria-busy aria-controls aria-describedby aria-disabled aria-dropeffect aria-flowto aria-grabbed aria-haspopup aria-hidden aria-invalid aria-label aria-labelledby aria-live aria-owns aria-relevant".split(" "); 484 axs.constants.NO_ROLE_NAME = " "; 485 axs.constants.WIDGET_ROLE_TO_NAME = {alert:"aria_role_alert", alertdialog:"aria_role_alertdialog", button:"aria_role_button", checkbox:"aria_role_checkbox", columnheader:"aria_role_columnheader", combobox:"aria_role_combobox", dialog:"aria_role_dialog", grid:"aria_role_grid", gridcell:"aria_role_gridcell", link:"aria_role_link", listbox:"aria_role_listbox", log:"aria_role_log", marquee:"aria_role_marquee", menu:"aria_role_menu", menubar:"aria_role_menubar", menuitem:"aria_role_menuitem", menuitemcheckbox:"aria_role_menuitemcheckbox", 486 menuitemradio:"aria_role_menuitemradio", option:axs.constants.NO_ROLE_NAME, progressbar:"aria_role_progressbar", radio:"aria_role_radio", radiogroup:"aria_role_radiogroup", rowheader:"aria_role_rowheader", scrollbar:"aria_role_scrollbar", slider:"aria_role_slider", spinbutton:"aria_role_spinbutton", status:"aria_role_status", tab:"aria_role_tab", tabpanel:"aria_role_tabpanel", textbox:"aria_role_textbox", timer:"aria_role_timer", toolbar:"aria_role_toolbar", tooltip:"aria_role_tooltip", treeitem:"aria_role_treeitem"}; 487 axs.constants.STRUCTURE_ROLE_TO_NAME = {article:"aria_role_article", application:"aria_role_application", banner:"aria_role_banner", columnheader:"aria_role_columnheader", complementary:"aria_role_complementary", contentinfo:"aria_role_contentinfo", definition:"aria_role_definition", directory:"aria_role_directory", document:"aria_role_document", form:"aria_role_form", group:"aria_role_group", heading:"aria_role_heading", img:"aria_role_img", list:"aria_role_list", listitem:"aria_role_listitem", 488 main:"aria_role_main", math:"aria_role_math", navigation:"aria_role_navigation", note:"aria_role_note", region:"aria_role_region", rowheader:"aria_role_rowheader", search:"aria_role_search", separator:"aria_role_separator"}; 489 axs.constants.ATTRIBUTE_VALUE_TO_STATUS = [{name:"aria-autocomplete", values:{inline:"aria_autocomplete_inline", list:"aria_autocomplete_list", both:"aria_autocomplete_both"}}, {name:"aria-checked", values:{"true":"aria_checked_true", "false":"aria_checked_false", mixed:"aria_checked_mixed"}}, {name:"aria-disabled", values:{"true":"aria_disabled_true"}}, {name:"aria-expanded", values:{"true":"aria_expanded_true", "false":"aria_expanded_false"}}, {name:"aria-invalid", values:{"true":"aria_invalid_true", 490 grammar:"aria_invalid_grammar", spelling:"aria_invalid_spelling"}}, {name:"aria-multiline", values:{"true":"aria_multiline_true"}}, {name:"aria-multiselectable", values:{"true":"aria_multiselectable_true"}}, {name:"aria-pressed", values:{"true":"aria_pressed_true", "false":"aria_pressed_false", mixed:"aria_pressed_mixed"}}, {name:"aria-readonly", values:{"true":"aria_readonly_true"}}, {name:"aria-required", values:{"true":"aria_required_true"}}, {name:"aria-selected", values:{"true":"aria_selected_true", 491 "false":"aria_selected_false"}}]; 492 axs.constants.INPUT_TYPE_TO_INFORMATION_TABLE_MSG = {button:"input_type_button", checkbox:"input_type_checkbox", color:"input_type_color", datetime:"input_type_datetime", "datetime-local":"input_type_datetime_local", date:"input_type_date", email:"input_type_email", file:"input_type_file", image:"input_type_image", month:"input_type_month", number:"input_type_number", password:"input_type_password", radio:"input_type_radio", range:"input_type_range", reset:"input_type_reset", search:"input_type_search", 493 submit:"input_type_submit", tel:"input_type_tel", text:"input_type_text", url:"input_type_url", week:"input_type_week"}; 494 axs.constants.TAG_TO_INFORMATION_TABLE_VERBOSE_MSG = {A:"tag_link", BUTTON:"tag_button", H1:"tag_h1", H2:"tag_h2", H3:"tag_h3", H4:"tag_h4", H5:"tag_h5", H6:"tag_h6", LI:"tag_li", OL:"tag_ol", SELECT:"tag_select", TEXTAREA:"tag_textarea", UL:"tag_ul", SECTION:"tag_section", NAV:"tag_nav", ARTICLE:"tag_article", ASIDE:"tag_aside", HGROUP:"tag_hgroup", HEADER:"tag_header", FOOTER:"tag_footer", TIME:"tag_time", MARK:"tag_mark"}; 495 axs.constants.TAG_TO_INFORMATION_TABLE_BRIEF_MSG = {BUTTON:"tag_button", SELECT:"tag_select", TEXTAREA:"tag_textarea"}; 496 axs.constants.MIXED_VALUES = {"true":!0, "false":!0, mixed:!0}; 497 (function() { 498 for (var a in axs.constants.ARIA_PROPERTIES) { 499 var b = axs.constants.ARIA_PROPERTIES[a]; 500 if (b.values) { 501 for (var c = {}, d = 0;d < b.values.length;d++) { 502 c[b.values[d]] = !0; 503 } 504 b.valuesSet = c; 505 } 506 } 507 })(); 508 axs.constants.Severity = {INFO:"Info", WARNING:"Warning", SEVERE:"Severe"}; 509 axs.constants.AuditResult = {PASS:"PASS", FAIL:"FAIL", NA:"NA"}; 510 axs.constants.InlineElements = {TT:!0, I:!0, B:!0, BIG:!0, SMALL:!0, EM:!0, STRONG:!0, DFN:!0, CODE:!0, SAMP:!0, KBD:!0, VAR:!0, CITE:!0, ABBR:!0, ACRONYM:!0, A:!0, IMG:!0, OBJECT:!0, BR:!0, SCRIPT:!0, MAP:!0, Q:!0, SUB:!0, SUP:!0, SPAN:!0, BDO:!0, INPUT:!0, SELECT:!0, TEXTAREA:!0, LABEL:!0, BUTTON:!0}; 511 axs.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.getComputedStyle(b); 602 return(c.right < d.left || c.bottom < d.top || c.left > d.right || c.top > d.bottom) && "hidden" == g.overflow ? !0 : c.right < f || c.bottom < e ? "visible" != g.overflow : !1; 603 }; 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.isAncestor(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.constants.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).length ? !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), b = parseInt(b[3], 10), d; 704 return new axs.utils.Color(a, c, b, 1); 705 } 706 return(b = a.match(/^rgba\((\d+), (\d+), (\d+), (\d+(\.\d+)?)\)/)) ? (d = parseInt(b[4], 10), a = parseInt(b[1], 10), c = parseInt(b[2], 10), b = parseInt(b[3], 10), new axs.utils.Color(a, c, b, d)) : null; 707 }; 708 axs.utils.colorChannelToString = function(a) { 709 a = Math.round(a); 710 return 15 >= a ? "0" + a.toString(16) : a.toString(16); 711 }; 712 axs.utils.colorToString = function(a) { 713 return 1 == a.alpha ? "#" + axs.utils.colorChannelToString(a.red) + axs.utils.colorChannelToString(a.green) + axs.utils.colorChannelToString(a.blue) : "rgba(" + [a.red, a.green, a.blue, a.alpha].join() + ")"; 714 }; 715 axs.utils.luminanceFromContrastRatio = function(a, b, c) { 716 return c ? (a + .05) * b - .05 : (a + .05) / b - .05; 717 }; 718 axs.utils.translateColor = function(a, b) { 719 var c = a[0], c = (b - c) / ((c > b ? 0 : 1) - c); 720 return axs.utils.fromYCC([b, a[1] - a[1] * c, a[2] - a[2] * c]); 721 }; 722 axs.utils.suggestColors = function(a, b, c, d) { 723 if (!axs.utils.isLowContrast(c, d, !0)) { 724 return null; 725 } 726 var e = {}, f = axs.utils.calculateLuminance(a), g = axs.utils.calculateLuminance(b), h = axs.utils.isLargeFont(d) ? 3 : 4.5, k = axs.utils.isLargeFont(d) ? 4.5 : 7, m = g > f, l = axs.utils.luminanceFromContrastRatio(f, h + .02, m), n = axs.utils.luminanceFromContrastRatio(f, k + .02, m), 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.translateColor(q, n), l = axs.utils.calculateContrastRatio(n, a), f = {}, f.fg = axs.utils.colorToString(n), f.bg = axs.utils.colorToString(a), f.contrast = l.toFixed(2), e.AAA = f); 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.contrast = 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.contrast = 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-labelledby") || 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.utils.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_ROLES[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 = {name: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.reason, 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.values ? 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 not 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.value); 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.valid = !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.valid = !1, d.reason ? (d.reason = [d.reason], d.reason.push(c.reason)) : (d.reason = c.reason, d.possibleValues = c.possibleValues)), d.values ? d.values.push(c.value) : d.values = [c.value]; 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.HTMLSelectElement || a instanceof b.HTMLTextAreaElement || a instanceof b.HTMLButtonElement || 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 return 1 == d ? axs.utils.getQuerySelectorText(a.parentNode) + " > " + b : axs.utils.getQuerySelectorText(a.parentNode) + " > " + b + ":nth-of-type(" + d + ")"; 1031 } 1032 if (a.parentNode) { 1033 b = a.parentNode.children; 1034 d = 1; 1035 for (c = 0;b[c] !== a;) { 1036 b[c].tagName == a.tagName && d++, c++; 1037 } 1038 c = ""; 1039 "BODY" != a.parentNode.tagName && (c = axs.utils.getQuerySelectorText(a.parentNode) + " > "); 1040 return 1 == d ? c + a.tagName : c + a.tagName + ":nth-of-type(" + d + ")"; 1041 } 1042 } else { 1043 if (a.selectorText) { 1044 return a.selectorText; 1045 } 1046 } 1047 return ""; 1048 }; 1049 axs.properties = {}; 1050 axs.properties.TEXT_CONTENT_XPATH = './/text()[normalize-space(.)!=""]/parent::*[name()!="script"]'; 1051 axs.properties.getFocusProperties = function(a) { 1052 var b = {}, c = a.getAttribute("tabindex"); 1053 void 0 != c ? b.tabindex = {value:c, valid:!0} : axs.utils.isElementImplicitlyFocusable(a) && (b.implicitlyFocusable = {value:!0, valid:!0}); 1054 if (0 == Object.keys(b).length) { 1055 return null; 1056 } 1057 var d = axs.utils.elementIsTransparent(a), e = axs.utils.elementHasZeroArea(a), f = axs.utils.elementIsOutsideScrollArea(a), g = axs.utils.overlappingElements(a); 1058 if (d || e || f || 0 < g.length) { 1059 var c = axs.utils.isElementOrAncestorHidden(a), h = {value:!1, valid:c}; 1060 d && (h.transparent = !0); 1061 e && (h.zeroArea = !0); 1062 f && (h.outsideScrollArea = !0); 1063 g && 0 < g.length && (h.overlappingElements = g); 1064 d = {value:c, valid:c}; 1065 c && (d.reason = axs.properties.getHiddenReason(a)); 1066 h.hidden = d; 1067 b.visible = h; 1068 } else { 1069 b.visible = {value:!0, valid:!0}; 1070 } 1071 return b; 1072 }; 1073 axs.properties.getHiddenReason = function(a) { 1074 if (!(a && a instanceof a.ownerDocument.defaultView.HTMLElement)) { 1075 return null; 1076 } 1077 if (a.hasAttribute("chromevoxignoreariahidden")) { 1078 var b = !0 1079 } 1080 var c = window.getComputedStyle(a, null); 1081 return "none" == c.display ? {property:"display: none", on:a} : "hidden" == c.visibility ? {property:"visibility: hidden", on:a} : a.hasAttribute("aria-hidden") && "true" == a.getAttribute("aria-hidden").toLowerCase() && !b ? {property:"aria-hidden", on:a} : axs.properties.getHiddenReason(axs.utils.parentElement(a)); 1082 }; 1083 axs.properties.getColorProperties = function(a) { 1084 var b = {}; 1085 (a = axs.properties.getContrastRatioProperties(a)) && (b.contrastRatio = a); 1086 return 0 == Object.keys(b).length ? null : b; 1087 }; 1088 axs.properties.hasDirectTextDescendant = function(a) { 1089 for (var b = (a.nodeType == Node.DOCUMENT_NODE ? a : a.ownerDocument).evaluate(axs.properties.TEXT_CONTENT_XPATH, a, null, XPathResult.ANY_TYPE, null), c = !1, d = b.iterateNext();null != d;d = b.iterateNext()) { 1090 if (d === a) { 1091 c = !0; 1092 break; 1093 } 1094 } 1095 return c; 1096 }; 1097 axs.properties.getContrastRatioProperties = function(a) { 1098 if (!axs.properties.hasDirectTextDescendant(a)) { 1099 return null; 1100 } 1101 var b = {}, c = window.getComputedStyle(a, null), d = axs.utils.getBgColor(c, a); 1102 if (!d) { 1103 return null; 1104 } 1105 b.backgroundColor = axs.utils.colorToString(d); 1106 var e = axs.utils.getFgColor(c, a, d); 1107 b.foregroundColor = axs.utils.colorToString(e); 1108 a = axs.utils.getContrastRatioForElementWithComputedStyle(c, a); 1109 if (!a) { 1110 return null; 1111 } 1112 b.value = a.toFixed(2); 1113 axs.utils.isLowContrast(a, c) && (b.alert = !0); 1114 (c = axs.utils.suggestColors(d, e, a, c)) && Object.keys(c).length && (b.suggestedColors = c); 1115 return b; 1116 }; 1117 axs.properties.findTextAlternatives = function(a, b, c, d) { 1118 var e = c || !1; 1119 c = axs.utils.asElement(a); 1120 if (!c || !e && !d && axs.utils.isElementOrAncestorHidden(c)) { 1121 return null; 1122 } 1123 if (a.nodeType == Node.TEXT_NODE) { 1124 return c = {type:"text"}, c.text = a.textContent, c.lastWord = axs.properties.getLastWord(c.text), b.content = c, a.textContent; 1125 } 1126 a = null; 1127 e || (a = axs.properties.getTextFromAriaLabelledby(c, b)); 1128 c.hasAttribute("aria-label") && (d = {type:"text"}, d.text = c.getAttribute("aria-label"), d.lastWord = axs.properties.getLastWord(d.text), a ? d.unused = !0 : e && axs.utils.elementIsHtmlControl(c) || (a = d.text), b.ariaLabel = d); 1129 c.hasAttribute("role") && "presentation" == c.getAttribute("role") || (a = axs.properties.getTextFromHostLanguageAttributes(c, b, a, e)); 1130 if (e && axs.utils.elementIsHtmlControl(c)) { 1131 d = c.ownerDocument.defaultView; 1132 if (c instanceof d.HTMLInputElement) { 1133 var f = c; 1134 "text" == f.type && f.value && 0 < f.value.length && (b.controlValue = {text:f.value}); 1135 "range" == f.type && (b.controlValue = {text:f.value}); 1136 } 1137 c instanceof d.HTMLSelectElement && (b.controlValue = {text:c.value}); 1138 b.controlValue && (d = b.controlValue, a ? d.unused = !0 : a = d.text); 1139 } 1140 if (e && axs.utils.elementIsAriaWidget(c)) { 1141 e = c.getAttribute("role"); 1142 "textbox" == e && c.textContent && 0 < c.textContent.length && (b.controlValue = {text:c.textContent}); 1143 if ("slider" == e || "spinbutton" == e) { 1144 c.hasAttribute("aria-valuetext") ? b.controlValue = {text:c.getAttribute("aria-valuetext")} : c.hasAttribute("aria-valuenow") && (b.controlValue = {value:c.getAttribute("aria-valuenow"), text:"" + c.getAttribute("aria-valuenow")}); 1145 } 1146 if ("menu" == e) { 1147 var g = c.querySelectorAll("[role=menuitemcheckbox], [role=menuitemradio]"); 1148 d = []; 1149 for (f = 0;f < g.length;f++) { 1150 "true" == g[f].getAttribute("aria-checked") && d.push(g[f]); 1151 } 1152 if (0 < d.length) { 1153 g = ""; 1154 for (f = 0;f < d.length;f++) { 1155 g += axs.properties.findTextAlternatives(d[f], {}, !0), f < d.length - 1 && (g += ", "); 1156 } 1157 b.controlValue = {text:g}; 1158 } 1159 } 1160 if ("combobox" == e || "select" == e) { 1161 b.controlValue = {text:"TODO"}; 1162 } 1163 b.controlValue && (d = b.controlValue, a ? d.unused = !0 : a = d.text); 1164 } 1165 d = !0; 1166 c.hasAttribute("role") && (e = c.getAttribute("role"), (e = axs.constants.ARIA_ROLES[e]) && (!e.namefrom || 0 > e.namefrom.indexOf("contents")) && (d = !1)); 1167 (e = axs.properties.getTextFromDescendantContent(c)) && d && (d = {type:"text"}, d.text = e, d.lastWord = axs.properties.getLastWord(d.text), a ? d.unused = !0 : a = e, b.content = d); 1168 c.hasAttribute("title") && (e = {type:"string", valid:!0}, e.text = c.getAttribute("title"), e.lastWord = axs.properties.getLastWord(e.lastWord), a ? e.unused = !0 : a = e.text, b.title = e); 1169 return 0 == Object.keys(b).length && null == a ? null : a; 1170 }; 1171 axs.properties.getTextFromDescendantContent = function(a) { 1172 var b = a.childNodes; 1173 a = []; 1174 for (var c = 0;c < b.length;c++) { 1175 var d = axs.properties.findTextAlternatives(b[c], {}, !0); 1176 d && a.push(d.trim()); 1177 } 1178 if (a.length) { 1179 b = ""; 1180 for (c = 0;c < a.length;c++) { 1181 b = [b, a[c]].join(" ").trim(); 1182 } 1183 return b; 1184 } 1185 return null; 1186 }; 1187 axs.properties.getTextFromAriaLabelledby = function(a, b) { 1188 var c = null; 1189 if (!a.hasAttribute("aria-labelledby")) { 1190 return c; 1191 } 1192 for (var d = a.getAttribute("aria-labelledby").split(/\s+/), e = {valid:!0}, f = [], g = [], h = 0;h < d.length;h++) { 1193 var k = {type:"element"}, m = d[h]; 1194 k.value = m; 1195 var l = document.getElementById(m); 1196 l ? (k.valid = !0, k.text = axs.properties.findTextAlternatives(l, {}, !0), k.lastWord = axs.properties.getLastWord(k.text), f.push(l.textContent.trim()), k.element = l) : (k.valid = !1, e.valid = !1, k.errorMessage = {messageKey:"noElementWithId", args:[m]}); 1197 g.push(k); 1198 } 1199 0 < g.length && (g[g.length - 1].last = !0, e.values = g, e.text = f.join(" "), e.lastWord = axs.properties.getLastWord(e.text), c = e.text, b.ariaLabelledby = e); 1200 return c; 1201 }; 1202 axs.properties.getTextFromHostLanguageAttributes = function(a, b, c, d) { 1203 if (axs.browserUtils.matchSelector(a, "img")) { 1204 if (a.hasAttribute("alt")) { 1205 var e = {type:"string", valid:!0}; 1206 e.text = a.getAttribute("alt"); 1207 c ? e.unused = !0 : c = e.text; 1208 b.alt = e; 1209 } else { 1210 e = {valid:!1, errorMessage:"No alt value provided"}, b.alt = e, e = a.src, "string" == typeof e && (c = e.split("/").pop(), b.filename = {text:c}); 1211 } 1212 } 1213 if (axs.browserUtils.matchSelector(a, 'input:not([type="hidden"]):not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), video:not([disabled])') && !d) { 1214 if (a.hasAttribute("id")) { 1215 d = document.querySelectorAll('label[for="' + a.id + '"]'); 1216 for (var e = {}, f = [], g = [], h = 0;h < d.length;h++) { 1217 var k = {type:"element"}, m = d[h], l = axs.properties.findTextAlternatives(m, {}, !0); 1218 l && 0 < l.trim().length && (k.text = l.trim(), g.push(l.trim())); 1219 k.element = m; 1220 f.push(k); 1221 } 1222 0 < f.length && (f[f.length - 1].last = !0, e.values = f, e.text = g.join(" "), e.lastWord = axs.properties.getLastWord(e.text), c ? e.unused = !0 : c = e.text, b.labelFor = e); 1223 } 1224 d = axs.utils.parentElement(a); 1225 for (e = {};d;) { 1226 if ("label" == d.tagName.toLowerCase() && (f = d, f.control == a)) { 1227 e.type = "element"; 1228 e.text = axs.properties.findTextAlternatives(f, {}, !0); 1229 e.lastWord = axs.properties.getLastWord(e.text); 1230 e.element = f; 1231 break; 1232 } 1233 d = axs.utils.parentElement(d); 1234 } 1235 e.text && (c ? e.unused = !0 : c = e.text, b.labelWrapped = e); 1236 Object.keys(b).length || (b.noLabel = !0); 1237 } 1238 return c; 1239 }; 1240 axs.properties.getLastWord = function(a) { 1241 if (!a) { 1242 return null; 1243 } 1244 var b = a.lastIndexOf(" ") + 1, c = a.length - 10; 1245 return a.substring(b > c ? b : c); 1246 }; 1247 axs.properties.getTextProperties = function(a) { 1248 var b = {}; 1249 a = axs.properties.findTextAlternatives(a, b, !1, !0); 1250 if (0 == Object.keys(b).length) { 1251 if (!a) { 1252 return null; 1253 } 1254 b.hasProperties = !1; 1255 } else { 1256 b.hasProperties = !0; 1257 } 1258 b.computedText = a; 1259 b.lastWord = axs.properties.getLastWord(a); 1260 return b; 1261 }; 1262 axs.properties.getAriaProperties = function(a) { 1263 var b = {}, c = axs.properties.getGlobalAriaProperties(a), d; 1264 for (d in axs.constants.ARIA_PROPERTIES) { 1265 var e = "aria-" + d; 1266 if (a.hasAttribute(e)) { 1267 var f = a.getAttribute(e); 1268 c[e] = axs.utils.getAriaPropertyValue(e, f, a); 1269 } 1270 } 1271 0 < Object.keys(c).length && (b.properties = axs.utils.values(c)); 1272 f = axs.utils.getRoles(a); 1273 if (!f) { 1274 return Object.keys(b).length ? b : null; 1275 } 1276 b.roles = f; 1277 if (!f.valid || !f.roles) { 1278 return b; 1279 } 1280 for (var e = f.roles, g = 0;g < e.length;g++) { 1281 var h = e[g]; 1282 if (h.details && h.details.propertiesSet) { 1283 for (d in h.details.propertiesSet) { 1284 d in c || (a.hasAttribute(d) ? (f = a.getAttribute(d), c[d] = axs.utils.getAriaPropertyValue(d, f, a), "values" in c[d] && (f = c[d].values, f[f.length - 1].isLast = !0)) : h.details.requiredPropertiesSet[d] && (c[d] = {name:d, valid:!1, reason:"Required property not set"})); 1285 } 1286 } 1287 } 1288 0 < Object.keys(c).length && (b.properties = axs.utils.values(c)); 1289 return 0 < Object.keys(b).length ? b : null; 1290 }; 1291 axs.properties.getGlobalAriaProperties = function(a) { 1292 for (var b = {}, c = 0;c < axs.constants.GLOBAL_PROPERTIES.length;c++) { 1293 var d = axs.constants.GLOBAL_PROPERTIES[c]; 1294 if (a.hasAttribute(d)) { 1295 var e = a.getAttribute(d); 1296 b[d] = axs.utils.getAriaPropertyValue(d, e, a); 1297 } 1298 } 1299 return b; 1300 }; 1301 axs.properties.getVideoProperties = function(a) { 1302 if (!axs.browserUtils.matchSelector(a, "video")) { 1303 return null; 1304 } 1305 var b = {}; 1306 b.captionTracks = axs.properties.getTrackElements(a, "captions"); 1307 b.descriptionTracks = axs.properties.getTrackElements(a, "descriptions"); 1308 b.chapterTracks = axs.properties.getTrackElements(a, "chapters"); 1309 return b; 1310 }; 1311 axs.properties.getTrackElements = function(a, b) { 1312 var c = a.querySelectorAll("track[kind=" + b + "]"), d = {}; 1313 if (!c.length) { 1314 return d.valid = !1, d.reason = {messageKey:"noTracksProvided", args:[[b]]}, d; 1315 } 1316 d.valid = !0; 1317 for (var e = [], f = 0;f < c.length;f++) { 1318 var g = {}, h = c[f].getAttribute("src"), k = c[f].getAttribute("srcLang"), m = c[f].getAttribute("label"); 1319 h ? (g.valid = !0, g.src = h) : (g.valid = !1, g.reason = {messageKey:"noSrcProvided"}); 1320 h = ""; 1321 m && (h += m, k && (h += " ")); 1322 k && (h += "(" + k + ")"); 1323 "" == h && (h = "[[object Object]]"); 1324 g.name = h; 1325 e.push(g); 1326 } 1327 d.values = e; 1328 return d; 1329 }; 1330 axs.properties.getAllProperties = function(a) { 1331 var b = axs.utils.asElement(a); 1332 if (!b) { 1333 return{}; 1334 } 1335 var c = {}; 1336 c.ariaProperties = axs.properties.getAriaProperties(b); 1337 c.colorProperties = axs.properties.getColorProperties(b); 1338 c.focusProperties = axs.properties.getFocusProperties(b); 1339 c.textProperties = axs.properties.getTextProperties(a); 1340 c.videoProperties = axs.properties.getVideoProperties(b); 1341 return c; 1342 }; 1343 axs.AuditRule = function(a) { 1344 for (var b = !0, c = [], d = 0;d < axs.AuditRule.requiredFields.length;d++) { 1345 var e = axs.AuditRule.requiredFields[d]; 1346 e in a || (b = !1, c.push(e)); 1347 } 1348 if (!b) { 1349 throw "Invalid spec; the following fields were not specified: " + c.join(", ") + "\n" + JSON.stringify(a); 1350 } 1351 this.name = a.name; 1352 this.severity = a.severity; 1353 this.relevantElementMatcher_ = a.relevantElementMatcher; 1354 this.test_ = a.test; 1355 this.code = a.code; 1356 this.heading = a.heading || ""; 1357 this.url = a.url || ""; 1358 this.requiresConsoleAPI = !!a.opt_requiresConsoleAPI; 1359 }; 1360 axs.AuditRule.requiredFields = "name severity relevantElementMatcher test code heading".split(" "); 1361 axs.AuditRule.NOT_APPLICABLE = {result:axs.constants.AuditResult.NA}; 1362 axs.AuditRule.prototype.addElement = function(a, b) { 1363 a.push(b); 1364 }; 1365 axs.AuditRule.collectMatchingElements = function(a, b, c, d) { 1366 if (a.nodeType == Node.ELEMENT_NODE) { 1367 var e = a 1368 } 1369 e && b.call(null, e) && c.push(e); 1370 if (e) { 1371 var f = e.shadowRoot || e.webkitShadowRoot; 1372 if (f) { 1373 axs.AuditRule.collectMatchingElements(f, b, c, f); 1374 return; 1375 } 1376 } 1377 if (e && "content" == e.localName) { 1378 for (e = e.getDistributedNodes(), a = 0;a < e.length;a++) { 1379 axs.AuditRule.collectMatchingElements(e[a], b, c, d); 1380 } 1381 } else { 1382 if (e && "shadow" == e.localName) { 1383 a = e, d ? (d = d.olderShadowRoot || a.olderShadowRoot) && axs.AuditRule.collectMatchingElements(d, b, c, d) : console.warn("ShadowRoot not provided for", e); 1384 } else { 1385 for (e = a.firstChild;null != e;) { 1386 axs.AuditRule.collectMatchingElements(e, b, c, d), e = e.nextSibling; 1387 } 1388 } 1389 } 1390 }; 1391 axs.AuditRule.prototype.run = function(a) { 1392 a = a || {}; 1393 var b = "ignoreSelectors" in a ? a.ignoreSelectors : [], c = "maxResults" in a ? a.maxResults : null, d = []; 1394 axs.AuditRule.collectMatchingElements("scope" in a ? a.scope : document, this.relevantElementMatcher_, d); 1395 var e = []; 1396 if (!d.length) { 1397 return{result:axs.constants.AuditResult.NA}; 1398 } 1399 for (a = 0;a < d.length && !(null != c && e.length >= c);a++) { 1400 var f = d[a], g; 1401 a: { 1402 g = f; 1403 for (var h = 0;h < b.length;h++) { 1404 if (axs.browserUtils.matchSelector(g, b[h])) { 1405 g = !0; 1406 break a; 1407 } 1408 } 1409 g = !1; 1410 } 1411 !g && this.test_(f) && this.addElement(e, f); 1412 } 1413 b = {result:e.length ? axs.constants.AuditResult.FAIL : axs.constants.AuditResult.PASS, elements:e}; 1414 a < d.length && (b.resultsTruncated = !0); 1415 return b; 1416 }; 1417 axs.AuditRule.specs = {}; 1418 axs.AuditRules = {}; 1419 axs.AuditRules.getRule = function(a) { 1420 if (!axs.AuditRules.rules) { 1421 axs.AuditRules.rules = {}; 1422 for (var b in axs.AuditRule.specs) { 1423 var c = axs.AuditRule.specs[b], d = new axs.AuditRule(c); 1424 axs.AuditRules.rules[c.name] = d; 1425 } 1426 } 1427 return axs.AuditRules.rules[a]; 1428 }; 1429 axs.AuditResults = function() { 1430 this.errors_ = []; 1431 this.warnings_ = []; 1432 }; 1433 goog.exportSymbol("axs.AuditResults", axs.AuditResults); 1434 axs.AuditResults.prototype.addError = function(a) { 1435 "" != a && this.errors_.push(a); 1436 }; 1437 goog.exportProperty(axs.AuditResults.prototype, "addError", axs.AuditResults.prototype.addError); 1438 axs.AuditResults.prototype.addWarning = function(a) { 1439 "" != a && this.warnings_.push(a); 1440 }; 1441 goog.exportProperty(axs.AuditResults.prototype, "addWarning", axs.AuditResults.prototype.addWarning); 1442 axs.AuditResults.prototype.numErrors = function() { 1443 return this.errors_.length; 1444 }; 1445 goog.exportProperty(axs.AuditResults.prototype, "numErrors", axs.AuditResults.prototype.numErrors); 1446 axs.AuditResults.prototype.numWarnings = function() { 1447 return this.warnings_.length; 1448 }; 1449 goog.exportProperty(axs.AuditResults.prototype, "numWarnings", axs.AuditResults.prototype.numWarnings); 1450 axs.AuditResults.prototype.getErrors = function() { 1451 return this.errors_; 1452 }; 1453 goog.exportProperty(axs.AuditResults.prototype, "getErrors", axs.AuditResults.prototype.getErrors); 1454 axs.AuditResults.prototype.getWarnings = function() { 1455 return this.warnings_; 1456 }; 1457 goog.exportProperty(axs.AuditResults.prototype, "getWarnings", axs.AuditResults.prototype.getWarnings); 1458 axs.AuditResults.prototype.toString = function() { 1459 for (var a = "", b = 0;b < this.errors_.length;b++) { 1460 0 == b && (a += "\nErrors:\n"); 1461 var c = this.errors_[b], a = a + (c + "\n\n"); 1462 } 1463 for (b = 0;b < this.warnings_.length;b++) { 1464 0 == b && (a += "\nWarnings:\n"), c = this.warnings_[b], a += c + "\n\n"; 1465 } 1466 return a; 1467 }; 1468 goog.exportProperty(axs.AuditResults.prototype, "toString", axs.AuditResults.prototype.toString); 1469 axs.Audit = {}; 1470 axs.AuditConfiguration = function() { 1471 this.rules_ = {}; 1472 this.maxResults = this.auditRulesToIgnore = this.auditRulesToRun = this.scope = null; 1473 this.withConsoleApi = !1; 1474 this.showUnsupportedRulesWarning = !0; 1475 goog.exportProperty(this, "scope", this.scope); 1476 goog.exportProperty(this, "auditRulesToRun", this.auditRulesToRun); 1477 goog.exportProperty(this, "auditRulesToIgnore", this.auditRulesToIgnore); 1478 goog.exportProperty(this, "withConsoleApi", this.withConsoleApi); 1479 goog.exportProperty(this, "showUnsupportedRulesWarning", this.showUnsupportedRulesWarning); 1480 }; 1481 goog.exportSymbol("axs.AuditConfiguration", axs.AuditConfiguration); 1482 axs.AuditConfiguration.prototype = {ignoreSelectors:function(a, b) { 1483 a in this.rules_ || (this.rules_[a] = {}); 1484 "ignore" in this.rules_[a] || (this.rules_[a].ignore = []); 1485 Array.prototype.push.call(this.rules_[a].ignore, b); 1486 }, getIgnoreSelectors:function(a) { 1487 return a in this.rules_ && "ignore" in this.rules_[a] ? this.rules_[a].ignore : []; 1488 }, setSeverity:function(a, b) { 1489 a in this.rules_ || (this.rules_[a] = {}); 1490 this.rules_[a].severity = b; 1491 }, getSeverity:function(a) { 1492 return a in this.rules_ && "severity" in this.rules_[a] ? this.rules_[a].severity : null; 1493 }}; 1494 goog.exportProperty(axs.AuditConfiguration.prototype, "ignoreSelectors", axs.AuditConfiguration.prototype.ignoreSelectors); 1495 goog.exportProperty(axs.AuditConfiguration.prototype, "getIgnoreSelectors", axs.AuditConfiguration.prototype.getIgnoreSelectors); 1496 axs.Audit.unsupportedRulesWarningShown = !1; 1497 axs.Audit.getRulesCannotRun = function(a) { 1498 return a.withConsoleApi ? [] : Object.keys(axs.AuditRule.specs).filter(function(a) { 1499 return axs.AuditRules.getRule(a).requiresConsoleAPI; 1500 }).map(function(a) { 1501 return axs.AuditRules.getRule(a).code; 1502 }); 1503 }; 1504 axs.Audit.run = function(a) { 1505 a = a || new axs.AuditConfiguration; 1506 var b = a.withConsoleApi, c = [], d; 1507 d = a.auditRulesToRun && 0 < a.auditRulesToRun.length ? a.auditRulesToRun : Object.keys(axs.AuditRule.specs); 1508 if (a.auditRulesToIgnore) { 1509 for (var e = 0;e < a.auditRulesToIgnore.length;e++) { 1510 var f = a.auditRulesToIgnore[e]; 1511 0 > d.indexOf(f) || d.splice(d.indexOf(f), 1); 1512 } 1513 } 1514 !axs.Audit.unsupportedRulesWarningShown && a.showUnsupportedRulesWarning && (e = axs.Audit.getRulesCannotRun(a), 0 < e.length && (console.warn("Some rules cannot be checked using the axs.Audit.run() method call. Use the Chrome plugin to check these rules: " + e.join(", ")), console.warn("To remove this message, pass an AuditConfiguration object to axs.Audit.run() and set configuration.showUnsupportedRulesWarning = false.")), axs.Audit.unsupportedRulesWarningShown = !0); 1515 for (e = 0;e < d.length;e++) { 1516 var f = d[e], g = axs.AuditRules.getRule(f); 1517 if (g && !g.disabled && (b || !g.requiresConsoleAPI)) { 1518 var h = {}, k = a.getIgnoreSelectors(g.name); 1519 if (0 < k.length || a.scope) { 1520 h.ignoreSelectors = k; 1521 } 1522 a.scope && (h.scope = a.scope); 1523 a.maxResults && (h.maxResults = a.maxResults); 1524 h = g.run.call(g, h); 1525 g = axs.utils.namedValues(g); 1526 g.severity = a.getSeverity(f) || g.severity; 1527 h.rule = g; 1528 c.push(h); 1529 } 1530 } 1531 return c; 1532 }; 1533 goog.exportSymbol("axs.Audit.run", axs.Audit.run); 1534 axs.Audit.auditResults = function(a) { 1535 for (var b = new axs.AuditResults, c = 0;c < a.length;c++) { 1536 var d = a[c]; 1537 d.result == axs.constants.AuditResult.FAIL && (d.rule.severity == axs.constants.Severity.SEVERE ? b.addError(axs.Audit.accessibilityErrorMessage(d)) : b.addWarning(axs.Audit.accessibilityErrorMessage(d))); 1538 } 1539 return b; 1540 }; 1541 goog.exportSymbol("axs.Audit.auditResults", axs.Audit.auditResults); 1542 axs.Audit.createReport = function(a, b) { 1543 var c; 1544 c = "*** Begin accessibility audit results ***\nAn accessibility audit found " + axs.Audit.auditResults(a).toString(); 1545 b && (c += "\nFor more information, please see ", c += b); 1546 return c += "\n*** End accessibility audit results ***"; 1547 }; 1548 goog.exportSymbol("axs.Audit.createReport", axs.Audit.createReport); 1549 axs.Audit.accessibilityErrorMessage = function(a) { 1550 for (var b = a.rule.severity == axs.constants.Severity.SEVERE ? "Error: " : "Warning: ", b = b + (a.rule.code + " (" + a.rule.heading + ") failed on the following " + (1 == a.elements.length ? "element" : "elements")), b = 1 == a.elements.length ? b + ":" : b + (" (1 - " + Math.min(5, a.elements.length) + " of " + a.elements.length + "):"), c = Math.min(a.elements.length, 5), d = 0;d < c;d++) { 1551 var e = a.elements[d], b = b + "\n"; 1552 try { 1553 b += axs.utils.getQuerySelectorText(e); 1554 } catch (f) { 1555 b += " tagName:" + e.tagName, b += " id:" + e.id; 1556 } 1557 } 1558 "" != a.rule.url && (b += "\nSee " + a.rule.url + " for more information."); 1559 return b; 1560 }; 1561 goog.exportSymbol("axs.Audit.accessibilityErrorMessage", axs.Audit.accessibilityErrorMessage); 1562 axs.AuditRule.specs.audioWithoutControls = {name:"audioWithoutControls", heading:"Audio elements should have controls", url:"", severity:axs.constants.Severity.WARNING, relevantElementMatcher:function(a) { 1563 return axs.browserUtils.matchSelector(a, "audio[autoplay]"); 1564 }, test:function(a) { 1565 return!a.querySelectorAll("[controls]").length && 3 < a.duration; 1566 }, code:"AX_AUDIO_01"}; 1567 axs.AuditRule.specs.badAriaAttributeValue = {name:"badAriaAttributeValue", heading:"ARIA state and property values must be valid", url:"", severity:axs.constants.Severity.SEVERE, relevantElementMatcher:function(a) { 1568 var b = "", c; 1569 for (c in axs.constants.ARIA_PROPERTIES) { 1570 b += "[aria-" + c + "],"; 1571 } 1572 b = b.substring(0, b.length - 1); 1573 return axs.browserUtils.matchSelector(a, b); 1574 }, test:function(a) { 1575 for (var b in axs.constants.ARIA_PROPERTIES) { 1576 var c = "aria-" + b; 1577 if (a.hasAttribute(c)) { 1578 var d = a.getAttribute(c); 1579 if (!axs.utils.getAriaPropertyValue(c, d, a).valid) { 1580 return!0; 1581 } 1582 } 1583 } 1584 return!1; 1585 }, code:"AX_ARIA_04"}; 1586 axs.AuditRule.specs.badAriaRole = {name:"badAriaRole", heading:"Elements with ARIA roles must use a valid, non-abstract ARIA role", url:"https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules#-ax_aria_01--elements-with-aria-roles-must-use-a-valid-non-abstract-aria-role", severity:axs.constants.Severity.SEVERE, relevantElementMatcher:function(a) { 1587 return axs.browserUtils.matchSelector(a, "[role]"); 1588 }, test:function(a) { 1589 return!axs.utils.getRoles(a).valid; 1590 }, code:"AX_ARIA_01"}; 1591 axs.AuditRule.specs.controlsWithoutLabel = {name:"controlsWithoutLabel", heading:"Controls and media elements should have labels", url:"https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules#-ax_text_01--controls-and-media-elements-should-have-labels", severity:axs.constants.Severity.SEVERE, relevantElementMatcher:function(a) { 1592 if (!axs.browserUtils.matchSelector(a, 'input:not([type="hidden"]):not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), video:not([disabled])')) { 1593 return!1; 1594 } 1595 if (0 <= a.tabIndex) { 1596 return!0; 1597 } 1598 for (a = axs.utils.parentElement(a);null != a;a = axs.utils.parentElement(a)) { 1599 if (axs.utils.elementIsAriaWidget(a)) { 1600 return!1; 1601 } 1602 } 1603 return!0; 1604 }, test:function(a) { 1605 return axs.utils.isElementOrAncestorHidden(a) || "input" == a.tagName.toLowerCase() && "button" == a.type && a.value.length || "button" == a.tagName.toLowerCase() && a.textContent.replace(/^\s+|\s+$/g, "").length ? !1 : axs.utils.hasLabel(a) ? !1 : !0; 1606 }, code:"AX_TEXT_01", ruleName:"Controls and media elements should have labels"}; 1607 axs.AuditRule.specs.focusableElementNotVisibleAndNotAriaHidden = {name:"focusableElementNotVisibleAndNotAriaHidden", heading:"These elements are focusable but either invisible or obscured by another element", url:"https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules#-ax_focus_01--these-elements-are-focusable-but-either-invisible-or-obscured-by-another-element", severity:axs.constants.Severity.WARNING, relevantElementMatcher:function(a) { 1608 if (!axs.browserUtils.matchSelector(a, axs.utils.FOCUSABLE_ELEMENTS_SELECTOR)) { 1609 return!1; 1610 } 1611 if (0 <= a.tabIndex) { 1612 return!0; 1613 } 1614 for (a = axs.utils.parentElement(a);null != a;a = axs.utils.parentElement(a)) { 1615 if (axs.utils.elementIsAriaWidget(a)) { 1616 return!1; 1617 } 1618 } 1619 return!0; 1620 }, test:function(a) { 1621 if (axs.utils.isElementOrAncestorHidden(a)) { 1622 return!1; 1623 } 1624 a.focus(); 1625 return!axs.utils.elementIsVisible(a); 1626 }, code:"AX_FOCUS_01"}; 1627 axs.AuditRule.specs.imagesWithoutAltText = {name:"imagesWithoutAltText", heading:"Images should have an alt attribute", url:"https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules#-ax_text_02--images-should-have-an-alt-attribute-unless-they-have-an-aria-role-of-presentation", severity:axs.constants.Severity.WARNING, relevantElementMatcher:function(a) { 1628 return axs.browserUtils.matchSelector(a, "img") && !axs.utils.isElementOrAncestorHidden(a); 1629 }, test:function(a) { 1630 return!a.hasAttribute("alt") && "presentation" != a.getAttribute("role"); 1631 }, code:"AX_TEXT_02"}; 1632 axs.AuditRule.specs.linkWithUnclearPurpose = {name:"linkWithUnclearPurpose", heading:"The purpose of each link should be clear from the link text", url:"", severity:axs.constants.Severity.WARNING, relevantElementMatcher:function(a) { 1633 return axs.browserUtils.matchSelector(a, "a"); 1634 }, test:function(a) { 1635 return/^\s*click\s*here\s*[^a-z]?$/i.test(a.textContent); 1636 }, code:"AX_TITLE_01"}; 1637 axs.AuditRule.specs.lowContrastElements = {name:"lowContrastElements", heading:"Text elements should have a reasonable contrast ratio", url:"https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules#-ax_color_01--text-elements-should-have-a-reasonable-contrast-ratio", severity:axs.constants.Severity.WARNING, relevantElementMatcher:function(a) { 1638 return axs.properties.hasDirectTextDescendant(a); 1639 }, test:function(a) { 1640 var b = window.getComputedStyle(a, null); 1641 return(a = axs.utils.getContrastRatioForElementWithComputedStyle(b, a)) && axs.utils.isLowContrast(a, b); 1642 }, code:"AX_COLOR_01"}; 1643 axs.AuditRule.specs.mainRoleOnInappropriateElement = {name:"mainRoleOnInappropriateElement", heading:"role=main should only appear on significant elements", url:"", severity:axs.constants.Severity.WARNING, relevantElementMatcher:function(a) { 1644 return axs.browserUtils.matchSelector(a, "[role~=main]"); 1645 }, test:function(a) { 1646 if (axs.utils.isInlineElement(a)) { 1647 return!0; 1648 } 1649 a = axs.properties.getTextFromDescendantContent(a); 1650 return!a || 50 > a.length ? !0 : !1; 1651 }, code:"AX_ARIA_04"}; 1652 axs.AuditRule.specs.elementsWithMeaningfulBackgroundImage = {name:"elementsWithMeaningfulBackgroundImage", severity:axs.constants.Severity.WARNING, relevantElementMatcher:function(a) { 1653 return!axs.utils.isElementOrAncestorHidden(a); 1654 }, heading:"Meaningful images should not be used in element backgrounds", url:"https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules#-ax_image_01--meaningful-images-should-not-be-used-in-element-backgrounds", test:function(a) { 1655 if (a.textContent && 0 < a.textContent.length) { 1656 return!1; 1657 } 1658 a = window.getComputedStyle(a, null); 1659 var b = a.backgroundImage; 1660 if (!b || "undefined" === b || "none" === b || 0 != b.indexOf("url")) { 1661 return!1; 1662 } 1663 b = parseInt(a.width, 10); 1664 a = parseInt(a.height, 10); 1665 return 150 > b && 150 > a; 1666 }, code:"AX_IMAGE_01"}; 1667 axs.AuditRule.specs.nonExistentAriaLabelledbyElement = {name:"nonExistentAriaLabelledbyElement", heading:"aria-labelledby attributes should refer to an element which exists in the DOM", url:"https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules#-ax_aria_02--aria-labelledby-attributes-should-refer-to-an-element-which-exists-in-the-dom", severity:axs.constants.Severity.WARNING, relevantElementMatcher:function(a) { 1668 return axs.browserUtils.matchSelector(a, "[aria-labelledby]"); 1669 }, test:function(a) { 1670 a = a.getAttribute("aria-labelledby").split(/\s+/); 1671 for (var b = 0;b < a.length;b++) { 1672 if (!document.getElementById(a[b])) { 1673 return!0; 1674 } 1675 } 1676 return!1; 1677 }, code:"AX_ARIA_02"}; 1678 axs.AuditRule.specs.pageWithoutTitle = {name:"pageWithoutTitle", heading:"The web page should have a title that describes topic or purpose", url:"", severity:axs.constants.Severity.WARNING, relevantElementMatcher:function(a) { 1679 return "html" == a.tagName.toLowerCase(); 1680 }, test:function(a) { 1681 a = a.querySelector("head"); 1682 return a ? (a = a.querySelector("title")) ? !a.textContent : !0 : !0; 1683 }, code:"AX_TITLE_01"}; 1684 axs.AuditRule.specs.requiredAriaAttributeMissing = {name:"requiredAriaAttributeMissing", heading:"Elements with ARIA roles must have all required attributes for that role", url:"https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules#-ax_aria_03--elements-with-aria-roles-must-have-all-required-attributes-for-that-role", severity:axs.constants.Severity.SEVERE, relevantElementMatcher:function(a) { 1685 return axs.browserUtils.matchSelector(a, "[role]"); 1686 }, test:function(a) { 1687 var b = axs.utils.getRoles(a); 1688 if (!b.valid) { 1689 return!1; 1690 } 1691 for (var c = 0;c < b.roles.length;c++) { 1692 var d = b.roles[c].details.requiredPropertiesSet, e; 1693 for (e in d) { 1694 if (d = e.replace(/^aria-/, ""), !("defaultValue" in axs.constants.ARIA_PROPERTIES[d] || a.hasAttribute(e))) { 1695 return!0; 1696 } 1697 } 1698 } 1699 }, code:"AX_ARIA_03"}; 1700 axs.AuditRule.specs.unfocusableElementsWithOnClick = {name:"unfocusableElementsWithOnClick", heading:"Elements with onclick handlers must be focusable", url:"https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules#-ax_focus_02--elements-with-onclick-handlers-must-be-focusable", severity:axs.constants.Severity.WARNING, opt_requiresConsoleAPI:!0, relevantElementMatcher:function(a) { 1701 return a instanceof a.ownerDocument.defaultView.HTMLBodyElement || axs.utils.isElementOrAncestorHidden(a) ? !1 : "click" in getEventListeners(a) ? !0 : !1; 1702 }, test:function(a) { 1703 return!a.hasAttribute("tabindex") && !axs.utils.isElementImplicitlyFocusable(a) && !a.disabled; 1704 }, code:"AX_FOCUS_02"}; 1705 axs.AuditRule.specs.videoWithoutCaptions = {name:"videoWithoutCaptions", heading:"Video elements should use <track> elements to provide captions", url:"https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules#-ax_video_01--video-elements-should-use-track-elements-to-provide-captions", severity:axs.constants.Severity.WARNING, relevantElementMatcher:function(a) { 1706 return axs.browserUtils.matchSelector(a, "video"); 1707 }, test:function(a) { 1708 return!a.querySelectorAll("track[kind=captions]").length; 1709 }, code:"AX_VIDEO_01"}; 1710 1711 1712