1 /* 2 * Copyright 2013 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/2f50bfddc20fb2b4e08e4106ac0f97ac892b31f1 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.exportPath_ = function(a, b, c) { 26 a = a.split("."); 27 c = c || goog.global; 28 a[0] in c || !c.execScript || c.execScript("var " + a[0]); 29 for(var d;a.length && (d = a.shift());) { 30 a.length || void 0 === b ? c = c[d] ? c[d] : c[d] = {} : c[d] = b 31 } 32 }; 33 goog.define = function(a, b) { 34 var c = b; 35 COMPILED || goog.global.CLOSURE_DEFINES && Object.prototype.hasOwnProperty.call(goog.global.CLOSURE_DEFINES, a) && (c = goog.global.CLOSURE_DEFINES[a]); 36 goog.exportPath_(a, c) 37 }; 38 goog.DEBUG = !0; 39 goog.LOCALE = "en"; 40 goog.TRUSTED_SITE = !0; 41 goog.provide = function(a) { 42 if(!COMPILED) { 43 if(goog.isProvided_(a)) { 44 throw Error('Namespace "' + a + '" already declared.'); 45 } 46 delete goog.implicitNamespaces_[a]; 47 for(var b = a;(b = b.substring(0, b.lastIndexOf("."))) && !goog.getObjectByName(b);) { 48 goog.implicitNamespaces_[b] = !0 49 } 50 } 51 goog.exportPath_(a) 52 }; 53 goog.setTestOnly = function(a) { 54 if(COMPILED && !goog.DEBUG) { 55 throw a = a || "", Error("Importing test-only code into non-debug environment" + a ? ": " + a : "."); 56 } 57 }; 58 COMPILED || (goog.isProvided_ = function(a) { 59 return!goog.implicitNamespaces_[a] && !!goog.getObjectByName(a) 60 }, goog.implicitNamespaces_ = {}); 61 goog.getObjectByName = function(a, b) { 62 for(var c = a.split("."), d = b || goog.global, e;e = c.shift();) { 63 if(goog.isDefAndNotNull(d[e])) { 64 d = d[e] 65 }else { 66 return null 67 } 68 } 69 return d 70 }; 71 goog.globalize = function(a, b) { 72 var c = b || goog.global, d; 73 for(d in a) { 74 c[d] = a[d] 75 } 76 }; 77 goog.addDependency = function(a, b, c) { 78 if(goog.DEPENDENCIES_ENABLED) { 79 var d; 80 a = a.replace(/\\/g, "/"); 81 for(var e = goog.dependencies_, f = 0;d = b[f];f++) { 82 e.nameToPath[d] = a, a in e.pathToNames || (e.pathToNames[a] = {}), e.pathToNames[a][d] = !0 83 } 84 for(d = 0;b = c[d];d++) { 85 a in e.requires || (e.requires[a] = {}), e.requires[a][b] = !0 86 } 87 } 88 }; 89 goog.ENABLE_DEBUG_LOADER = !0; 90 goog.require = function(a) { 91 if(!COMPILED && !goog.isProvided_(a)) { 92 if(goog.ENABLE_DEBUG_LOADER) { 93 var b = goog.getPathFromDeps_(a); 94 if(b) { 95 goog.included_[b] = !0; 96 goog.writeScripts_(); 97 return 98 } 99 } 100 a = "goog.require could not find: " + a; 101 goog.global.console && goog.global.console.error(a); 102 throw Error(a); 103 } 104 }; 105 goog.basePath = ""; 106 goog.nullFunction = function() { 107 }; 108 goog.identityFunction = function(a, b) { 109 return a 110 }; 111 goog.abstractMethod = function() { 112 throw Error("unimplemented abstract method"); 113 }; 114 goog.addSingletonGetter = function(a) { 115 a.getInstance = function() { 116 if(a.instance_) { 117 return a.instance_ 118 } 119 goog.DEBUG && (goog.instantiatedSingletons_[goog.instantiatedSingletons_.length] = a); 120 return a.instance_ = new a 121 } 122 }; 123 goog.instantiatedSingletons_ = []; 124 goog.DEPENDENCIES_ENABLED = !COMPILED && goog.ENABLE_DEBUG_LOADER; 125 goog.DEPENDENCIES_ENABLED && (goog.included_ = {}, goog.dependencies_ = {pathToNames:{}, nameToPath:{}, requires:{}, visited:{}, written:{}}, goog.inHtmlDocument_ = function() { 126 var a = goog.global.document; 127 return"undefined" != typeof a && "write" in a 128 }, goog.findBasePath_ = function() { 129 if(goog.global.CLOSURE_BASE_PATH) { 130 goog.basePath = goog.global.CLOSURE_BASE_PATH 131 }else { 132 if(goog.inHtmlDocument_()) { 133 for(var a = goog.global.document.getElementsByTagName("script"), b = a.length - 1;0 <= b;--b) { 134 var c = a[b].src, d = c.lastIndexOf("?"), d = -1 == d ? c.length : d; 135 if("base.js" == c.substr(d - 7, 7)) { 136 goog.basePath = c.substr(0, d - 7); 137 break 138 } 139 } 140 } 141 } 142 }, goog.importScript_ = function(a) { 143 var b = goog.global.CLOSURE_IMPORT_SCRIPT || goog.writeScriptTag_; 144 !goog.dependencies_.written[a] && b(a) && (goog.dependencies_.written[a] = !0) 145 }, goog.writeScriptTag_ = function(a) { 146 if(goog.inHtmlDocument_()) { 147 var b = goog.global.document; 148 if("complete" == b.readyState) { 149 if(/\bdeps.js$/.test(a)) { 150 return!1 151 } 152 throw Error('Cannot write "' + a + '" after document load'); 153 } 154 b.write('<script type="text/javascript" src="' + a + '">\x3c/script>'); 155 return!0 156 } 157 return!1 158 }, goog.writeScripts_ = function() { 159 function a(e) { 160 if(!(e in d.written)) { 161 if(!(e in d.visited) && (d.visited[e] = !0, e in d.requires)) { 162 for(var g in d.requires[e]) { 163 if(!goog.isProvided_(g)) { 164 if(g in d.nameToPath) { 165 a(d.nameToPath[g]) 166 }else { 167 throw Error("Undefined nameToPath for " + g); 168 } 169 } 170 } 171 } 172 e in c || (c[e] = !0, b.push(e)) 173 } 174 } 175 var b = [], c = {}, d = goog.dependencies_, e; 176 for(e in goog.included_) { 177 d.written[e] || a(e) 178 } 179 for(e = 0;e < b.length;e++) { 180 if(b[e]) { 181 goog.importScript_(goog.basePath + b[e]) 182 }else { 183 throw Error("Undefined script input"); 184 } 185 } 186 }, goog.getPathFromDeps_ = function(a) { 187 return a in goog.dependencies_.nameToPath ? goog.dependencies_.nameToPath[a] : null 188 }, goog.findBasePath_(), goog.global.CLOSURE_NO_DEPS || goog.importScript_(goog.basePath + "deps.js")); 189 goog.typeOf = function(a) { 190 var b = typeof a; 191 if("object" == b) { 192 if(a) { 193 if(a instanceof Array) { 194 return"array" 195 } 196 if(a instanceof Object) { 197 return b 198 } 199 var c = Object.prototype.toString.call(a); 200 if("[object Window]" == c) { 201 return"object" 202 } 203 if("[object Array]" == c || "number" == typeof a.length && "undefined" != typeof a.splice && "undefined" != typeof a.propertyIsEnumerable && !a.propertyIsEnumerable("splice")) { 204 return"array" 205 } 206 if("[object Function]" == c || "undefined" != typeof a.call && "undefined" != typeof a.propertyIsEnumerable && !a.propertyIsEnumerable("call")) { 207 return"function" 208 } 209 }else { 210 return"null" 211 } 212 }else { 213 if("function" == b && "undefined" == typeof a.call) { 214 return"object" 215 } 216 } 217 return b 218 }; 219 goog.isDef = function(a) { 220 return void 0 !== a 221 }; 222 goog.isNull = function(a) { 223 return null === a 224 }; 225 goog.isDefAndNotNull = function(a) { 226 return null != a 227 }; 228 goog.isArray = function(a) { 229 return"array" == goog.typeOf(a) 230 }; 231 goog.isArrayLike = function(a) { 232 var b = goog.typeOf(a); 233 return"array" == b || "object" == b && "number" == typeof a.length 234 }; 235 goog.isDateLike = function(a) { 236 return goog.isObject(a) && "function" == typeof a.getFullYear 237 }; 238 goog.isString = function(a) { 239 return"string" == typeof a 240 }; 241 goog.isBoolean = function(a) { 242 return"boolean" == typeof a 243 }; 244 goog.isNumber = function(a) { 245 return"number" == typeof a 246 }; 247 goog.isFunction = function(a) { 248 return"function" == goog.typeOf(a) 249 }; 250 goog.isObject = function(a) { 251 var b = typeof a; 252 return"object" == b && null != a || "function" == b 253 }; 254 goog.getUid = function(a) { 255 return a[goog.UID_PROPERTY_] || (a[goog.UID_PROPERTY_] = ++goog.uidCounter_) 256 }; 257 goog.removeUid = function(a) { 258 "removeAttribute" in a && a.removeAttribute(goog.UID_PROPERTY_); 259 try { 260 delete a[goog.UID_PROPERTY_] 261 }catch(b) { 262 } 263 }; 264 goog.UID_PROPERTY_ = "closure_uid_" + (1E9 * Math.random() >>> 0); 265 goog.uidCounter_ = 0; 266 goog.getHashCode = goog.getUid; 267 goog.removeHashCode = goog.removeUid; 268 goog.cloneObject = function(a) { 269 var b = goog.typeOf(a); 270 if("object" == b || "array" == b) { 271 if(a.clone) { 272 return a.clone() 273 } 274 var b = "array" == b ? [] : {}, c; 275 for(c in a) { 276 b[c] = goog.cloneObject(a[c]) 277 } 278 return b 279 } 280 return a 281 }; 282 goog.bindNative_ = function(a, b, c) { 283 return a.call.apply(a.bind, arguments) 284 }; 285 goog.bindJs_ = function(a, b, c) { 286 if(!a) { 287 throw Error(); 288 } 289 if(2 < arguments.length) { 290 var d = Array.prototype.slice.call(arguments, 2); 291 return function() { 292 var c = Array.prototype.slice.call(arguments); 293 Array.prototype.unshift.apply(c, d); 294 return a.apply(b, c) 295 } 296 } 297 return function() { 298 return a.apply(b, arguments) 299 } 300 }; 301 goog.bind = function(a, b, c) { 302 Function.prototype.bind && -1 != Function.prototype.bind.toString().indexOf("native code") ? goog.bind = goog.bindNative_ : goog.bind = goog.bindJs_; 303 return goog.bind.apply(null, arguments) 304 }; 305 goog.partial = function(a, b) { 306 var c = Array.prototype.slice.call(arguments, 1); 307 return function() { 308 var b = Array.prototype.slice.call(arguments); 309 b.unshift.apply(b, c); 310 return a.apply(this, b) 311 } 312 }; 313 goog.mixin = function(a, b) { 314 for(var c in b) { 315 a[c] = b[c] 316 } 317 }; 318 goog.now = goog.TRUSTED_SITE && Date.now || function() { 319 return+new Date 320 }; 321 goog.globalEval = function(a) { 322 if(goog.global.execScript) { 323 goog.global.execScript(a, "JavaScript") 324 }else { 325 if(goog.global.eval) { 326 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_) { 327 goog.global.eval(a) 328 }else { 329 var b = goog.global.document, c = b.createElement("script"); 330 c.type = "text/javascript"; 331 c.defer = !1; 332 c.appendChild(b.createTextNode(a)); 333 b.body.appendChild(c); 334 b.body.removeChild(c) 335 } 336 }else { 337 throw Error("goog.globalEval not available"); 338 } 339 } 340 }; 341 goog.evalWorksForGlobals_ = null; 342 goog.getCssName = function(a, b) { 343 var c = function(a) { 344 return goog.cssNameMapping_[a] || a 345 }, d = function(a) { 346 a = a.split("-"); 347 for(var b = [], d = 0;d < a.length;d++) { 348 b.push(c(a[d])) 349 } 350 return b.join("-") 351 }, d = goog.cssNameMapping_ ? "BY_WHOLE" == goog.cssNameMappingStyle_ ? c : d : function(a) { 352 return a 353 }; 354 return b ? a + "-" + d(b) : d(a) 355 }; 356 goog.setCssNameMapping = function(a, b) { 357 goog.cssNameMapping_ = a; 358 goog.cssNameMappingStyle_ = b 359 }; 360 !COMPILED && goog.global.CLOSURE_CSS_NAME_MAPPING && (goog.cssNameMapping_ = goog.global.CLOSURE_CSS_NAME_MAPPING); 361 goog.getMsg = function(a, b) { 362 var c = b || {}, d; 363 for(d in c) { 364 var e = ("" + c[d]).replace(/\$/g, "$$$$"); 365 a = a.replace(RegExp("\\{\\$" + d + "\\}", "gi"), e) 366 } 367 return a 368 }; 369 goog.getMsgWithFallback = function(a, b) { 370 return a 371 }; 372 goog.exportSymbol = function(a, b, c) { 373 goog.exportPath_(a, b, c) 374 }; 375 goog.exportProperty = function(a, b, c) { 376 a[b] = c 377 }; 378 goog.inherits = function(a, b) { 379 function c() { 380 } 381 c.prototype = b.prototype; 382 a.superClass_ = b.prototype; 383 a.prototype = new c; 384 a.prototype.constructor = a 385 }; 386 goog.base = function(a, b, c) { 387 var d = arguments.callee.caller; 388 if(goog.DEBUG && !d) { 389 throw Error("arguments.caller not defined. goog.base() expects not to be running in strict mode. See http://www.ecma-international.org/ecma-262/5.1/#sec-C"); 390 } 391 if(d.superClass_) { 392 return d.superClass_.constructor.apply(a, Array.prototype.slice.call(arguments, 1)) 393 } 394 for(var e = Array.prototype.slice.call(arguments, 2), f = !1, g = a.constructor;g;g = g.superClass_ && g.superClass_.constructor) { 395 if(g.prototype[b] === d) { 396 f = !0 397 }else { 398 if(f) { 399 return g.prototype[b].apply(a, e) 400 } 401 } 402 } 403 if(a[b] === d) { 404 return a.constructor.prototype[b].apply(a, e) 405 } 406 throw Error("goog.base called from a method of one name to a method of a different name"); 407 }; 408 goog.scope = function(a) { 409 a.call(goog.global) 410 }; 411 var axs = {}; 412 axs.browserUtils = {}; 413 axs.browserUtils.matchSelector = function(a, b) { 414 return a.webkitMatchesSelector ? a.webkitMatchesSelector(b) : a.mozMatchesSelector ? a.mozMatchesSelector(b) : !1 415 }; 416 axs.constants = {}; 417 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", 418 "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"], 419 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"], 420 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"]}, 421 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"]}, 422 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"], 423 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"], 424 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"], 425 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(" ")}, 426 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"], 427 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", 428 "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", 429 "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"], 430 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"], 431 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"]}}; 432 axs.constants.WIDGET_ROLES = {}; 433 axs.constants.addAllParentRolesToSet_ = function(a, b) { 434 if(a.parent) { 435 for(var c = a.parent, d = 0;d < c.length;d++) { 436 var e = c[d]; 437 b[e] = !0; 438 axs.constants.addAllParentRolesToSet_(axs.constants.ARIA_ROLES[e], b) 439 } 440 } 441 }; 442 axs.constants.addAllPropertiesToSet_ = function(a, b, c) { 443 var d = a[b]; 444 if(d) { 445 for(var e = 0;e < d.length;e++) { 446 c[d[e]] = !0 447 } 448 } 449 if(a.parent) { 450 for(a = a.parent, d = 0;d < a.length;d++) { 451 axs.constants.addAllPropertiesToSet_(axs.constants.ARIA_ROLES[a[d]], b, c) 452 } 453 } 454 }; 455 for(var roleName in axs.constants.ARIA_ROLES) { 456 var role = axs.constants.ARIA_ROLES[roleName], propertiesSet = {}; 457 axs.constants.addAllPropertiesToSet_(role, "properties", propertiesSet); 458 role.propertiesSet = propertiesSet; 459 var requiredPropertiesSet = {}; 460 axs.constants.addAllPropertiesToSet_(role, "requiredProperties", requiredPropertiesSet); 461 role.requiredPropertiesSet = requiredPropertiesSet; 462 var parentRolesSet = {}; 463 axs.constants.addAllParentRolesToSet_(role, parentRolesSet); 464 role.allParentRolesSet = parentRolesSet; 465 "widget" in parentRolesSet && (axs.constants.WIDGET_ROLES[roleName] = role) 466 } 467 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"}, 468 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", 469 "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"]}, 470 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", 471 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", 472 "other"]}, valuemax:{type:"property", valueType:"decimal"}, valuemin:{type:"property", valueType:"decimal"}, valuenow:{type:"property", valueType:"decimal"}, valuetext:{type:"property", valueType:"string"}}; 473 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(" "); 474 axs.constants.NO_ROLE_NAME = " "; 475 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", 476 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"}; 477 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", 478 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"}; 479 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", 480 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", 481 "false":"aria_selected_false"}}]; 482 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", 483 submit:"input_type_submit", tel:"input_type_tel", text:"input_type_text", url:"input_type_url", week:"input_type_week"}; 484 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"}; 485 axs.constants.TAG_TO_INFORMATION_TABLE_BRIEF_MSG = {BUTTON:"tag_button", SELECT:"tag_select", TEXTAREA:"tag_textarea"}; 486 axs.constants.MIXED_VALUES = {"true":!0, "false":!0, mixed:!0}; 487 (function() { 488 for(var a in axs.constants.ARIA_PROPERTIES) { 489 var b = axs.constants.ARIA_PROPERTIES[a]; 490 if(b.values) { 491 for(var c = {}, d = 0;d < b.values.length;d++) { 492 c[b.values[d]] = !0 493 } 494 b.valuesSet = c 495 } 496 } 497 })(); 498 axs.constants.Severity = {INFO:"Info", WARNING:"Warning", SEVERE:"Severe"}; 499 axs.constants.AuditResult = {PASS:"PASS", FAIL:"FAIL", NA:"NA"}; 500 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}; 501 axs.utils = {}; 502 axs.utils.FOCUSABLE_ELEMENTS_SELECTOR = "input:not([type=hidden]):not([disabled]),select:not([disabled]),textarea:not([disabled]),button:not([disabled]),a[href],iframe,[tabindex]"; 503 axs.utils.Color = function(a, b, c, d) { 504 this.red = a; 505 this.green = b; 506 this.blue = c; 507 this.alpha = d 508 }; 509 axs.utils.calculateContrastRatio = function(a, b) { 510 if(!a || !b) { 511 return null 512 } 513 1 > a.alpha && (a = axs.utils.flattenColors(a, b)); 514 var c = axs.utils.calculateLuminance(a), d = axs.utils.calculateLuminance(b); 515 return(Math.max(c, d) + 0.05) / (Math.min(c, d) + 0.05) 516 }; 517 axs.utils.luminanceRatio = function(a, b) { 518 return(Math.max(a, b) + 0.05) / (Math.min(a, b) + 0.05) 519 }; 520 axs.utils.asElement = function(a) { 521 switch(a.nodeType) { 522 case Node.COMMENT_NODE: 523 return null; 524 case Node.ELEMENT_NODE: 525 if("script" == a.tagName.toLowerCase()) { 526 return null 527 } 528 break; 529 case Node.TEXT_NODE: 530 a = a.parentElement; 531 break; 532 default: 533 return console.warn("Unhandled node type: ", a.nodeType), null 534 } 535 return a 536 }; 537 axs.utils.elementIsTransparent = function(a) { 538 return"0" == a.style.opacity 539 }; 540 axs.utils.elementHasZeroArea = function(a) { 541 a = a.getBoundingClientRect(); 542 var b = a.top - a.bottom; 543 return a.right - a.left && b ? !1 : !0 544 }; 545 axs.utils.elementIsOutsideScrollArea = function(a) { 546 a = a.getBoundingClientRect(); 547 var b = document.body.scrollWidth, c = document.body.scrollTop, d = document.body.scrollLeft; 548 return a.top >= document.body.scrollHeight || a.bottom <= -c || a.left >= b || a.right <= -d ? !0 : !1 549 }; 550 axs.utils.isAncestor = function(a, b) { 551 return null == b ? !1 : b === a ? !0 : axs.utils.isAncestor(a, b.parentNode) 552 }; 553 axs.utils.overlappingElements = function(a) { 554 if(axs.utils.elementHasZeroArea(a)) { 555 return null 556 } 557 for(var b = [], c = a.getClientRects(), d = 0;d < c.length;d++) { 558 var e = c[d], e = document.elementFromPoint((e.left + e.right) / 2, (e.top + e.bottom) / 2); 559 if(null != e && e != a && !axs.utils.isAncestor(e, a) && !axs.utils.isAncestor(a, e)) { 560 var f = window.getComputedStyle(e, null); 561 f && (f = axs.utils.getBgColor(f, e)) && 0 < f.alpha && 0 > b.indexOf(e) && b.push(e) 562 } 563 } 564 return b 565 }; 566 axs.utils.elementIsHtmlControl = function(a) { 567 var b = a.ownerDocument.defaultView; 568 return a instanceof b.HTMLButtonElement || a instanceof b.HTMLInputElement || a instanceof b.HTMLSelectElement || a instanceof b.HTMLTextAreaElement ? !0 : !1 569 }; 570 axs.utils.elementIsAriaWidget = function(a) { 571 return a.hasAttribute("role") && (a = a.getAttribute("role")) && (a = axs.constants.ARIA_ROLES[a]) && "widget" in a.allParentRolesSet ? !0 : !1 572 }; 573 axs.utils.elementIsVisible = function(a) { 574 return axs.utils.elementIsTransparent(a) || axs.utils.elementHasZeroArea(a) || axs.utils.elementIsOutsideScrollArea(a) || axs.utils.overlappingElements(a).length ? !1 : !0 575 }; 576 axs.utils.isLargeFont = function(a) { 577 var b = a.fontSize; 578 a = "bold" == a.fontWeight; 579 var c = b.match(/(\d+)px/); 580 if(c) { 581 b = parseInt(c[1], 10); 582 if(c = window.getComputedStyle(document.body, null).fontSize.match(/(\d+)px/)) { 583 var d = parseInt(c[1], 10), c = 1.2 * d, d = 1.5 * d 584 }else { 585 c = 19.2, d = 24 586 } 587 return a && b >= c || b >= d 588 } 589 if(c = b.match(/(\d+)em/)) { 590 return b = parseInt(c[1], 10), a && 1.2 <= b || 1.5 <= b ? !0 : !1 591 } 592 if(c = b.match(/(\d+)%/)) { 593 return b = parseInt(c[1], 10), a && 120 <= b || 150 <= b ? !0 : !1 594 } 595 if(c = b.match(/(\d+)pt/)) { 596 if(b = parseInt(c[1], 10), a && 14 <= b || 18 <= b) { 597 return!0 598 } 599 } 600 return!1 601 }; 602 axs.utils.getBgColor = function(a, b) { 603 var c = axs.utils.parseColor(a.backgroundColor); 604 if(!c) { 605 return null 606 } 607 1 > a.opacity && (c.alpha *= a.opacity); 608 if(1 > c.alpha) { 609 var d = axs.utils.getParentBgColor(b); 610 if(null == d) { 611 return null 612 } 613 c = axs.utils.flattenColors(c, d) 614 } 615 return c 616 }; 617 axs.utils.getParentBgColor = function(a) { 618 var b = a; 619 a = []; 620 for(var c = null;b = b.parentElement;) { 621 var d = window.getComputedStyle(b, null); 622 if(d) { 623 var e = axs.utils.parseColor(d.backgroundColor); 624 if(e && (1 > d.opacity && (e.alpha *= d.opacity), 0 != e.alpha && (a.push(e), 1 == e.alpha))) { 625 c = !0; 626 break 627 } 628 } 629 } 630 c || a.push(new axs.utils.Color(255, 255, 255, 1)); 631 for(b = a.pop();a.length;) { 632 c = a.pop(), b = axs.utils.flattenColors(c, b) 633 } 634 return b 635 }; 636 axs.utils.getFgColor = function(a, b, c) { 637 var d = axs.utils.parseColor(a.color); 638 if(!d) { 639 return null 640 } 641 1 > d.alpha && (d = axs.utils.flattenColors(d, c)); 642 1 > a.opacity && (b = axs.utils.getParentBgColor(b), d.alpha *= a.opacity, d = axs.utils.flattenColors(d, b)); 643 return d 644 }; 645 axs.utils.parseColor = function(a) { 646 var b = a.match(/^rgb\((\d+), (\d+), (\d+)\)$/); 647 if(b) { 648 a = parseInt(b[1], 10); 649 var c = parseInt(b[2], 10), b = parseInt(b[3], 10), d; 650 return new axs.utils.Color(a, c, b, 1) 651 } 652 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 653 }; 654 axs.utils.colorChannelToString = function(a) { 655 a = Math.round(a); 656 return 15 >= a ? "0" + a.toString(16) : a.toString(16) 657 }; 658 axs.utils.colorToString = function(a) { 659 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() + ")" 660 }; 661 axs.utils.luminanceFromContrastRatio = function(a, b, c) { 662 return c ? (a + 0.05) * b - 0.05 : (a + 0.05) / b - 0.05 663 }; 664 axs.utils.translateColor = function(a, b) { 665 var c = a[0], c = (b - c) / ((c > b ? 0 : 1) - c); 666 return axs.utils.fromYCC([b, a[1] - a[1] * c, a[2] - a[2] * c]) 667 }; 668 axs.utils.suggestColors = function(a, b, c, d) { 669 if(!axs.utils.isLowContrast(c, d, !0)) { 670 return null 671 } 672 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 + 0.02, m), n = axs.utils.luminanceFromContrastRatio(f, k + 0.02, m), q = axs.utils.toYCC(b); 673 if(axs.utils.isLowContrast(c, d, !1) && 1 >= l && 0 <= l) { 674 var p = axs.utils.translateColor(q, l), l = axs.utils.calculateContrastRatio(p, a); 675 axs.utils.calculateLuminance(p); 676 f = {}; 677 f.fg = axs.utils.colorToString(p); 678 f.bg = axs.utils.colorToString(a); 679 f.contrast = l.toFixed(2); 680 e.AA = f 681 } 682 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); 683 h = axs.utils.luminanceFromContrastRatio(g, h + 0.02, !m); 684 g = axs.utils.luminanceFromContrastRatio(g, k + 0.02, !m); 685 a = axs.utils.toYCC(a); 686 !("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); 687 !("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); 688 return e 689 }; 690 axs.utils.flattenColors = function(a, b) { 691 var c = a.alpha; 692 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)) 693 }; 694 axs.utils.calculateLuminance = function(a) { 695 return axs.utils.toYCC(a)[0] 696 }; 697 axs.utils.RGBToYCCMatrix = function(a, b) { 698 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)]] 699 }; 700 axs.utils.invert3x3Matrix = function(a) { 701 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]; 702 a = a[2][2]; 703 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))) 704 }; 705 axs.utils.scalarMultiplyMatrix = function(a, b) { 706 for(var c = [[], [], []], d = 0;3 > d;d++) { 707 for(var e = 0;3 > e;e++) { 708 c[d][e] = a[d][e] * b 709 } 710 } 711 return c 712 }; 713 axs.utils.kR = 0.2126; 714 axs.utils.kB = 0.0722; 715 axs.utils.YCC_MATRIX = axs.utils.RGBToYCCMatrix(axs.utils.kR, axs.utils.kB); 716 axs.utils.INVERTED_YCC_MATRIX = axs.utils.invert3x3Matrix(axs.utils.YCC_MATRIX); 717 axs.utils.convertColor = function(a, b) { 718 var c = b[0], d = b[1], e = b[2]; 719 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] 720 }; 721 axs.utils.multiplyMatrices = function(a, b) { 722 for(var c = [[], [], []], d = 0;3 > d;d++) { 723 for(var e = 0;3 > e;e++) { 724 c[d][e] = a[d][0] * b[0][e] + a[d][1] * b[1][e] + a[d][2] * b[2][e] 725 } 726 } 727 return c 728 }; 729 axs.utils.toYCC = function(a) { 730 var b = a.red / 255, c = a.green / 255; 731 a = a.blue / 255; 732 b = 0.03928 >= b ? b / 12.92 : Math.pow((b + 0.055) / 1.055, 2.4); 733 c = 0.03928 >= c ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4); 734 a = 0.03928 >= a ? a / 12.92 : Math.pow((a + 0.055) / 1.055, 2.4); 735 return axs.utils.convertColor(axs.utils.YCC_MATRIX, [b, c, a]) 736 }; 737 axs.utils.fromYCC = function(a) { 738 var b = axs.utils.convertColor(axs.utils.INVERTED_YCC_MATRIX, a), c = b[0]; 739 a = b[1]; 740 b = b[2]; 741 c = 0.00303949 >= c ? 12.92 * c : 1.055 * Math.pow(c, 1 / 2.4) - 0.055; 742 a = 0.00303949 >= a ? 12.92 * a : 1.055 * Math.pow(a, 1 / 2.4) - 0.055; 743 b = 0.00303949 >= b ? 12.92 * b : 1.055 * Math.pow(b, 1 / 2.4) - 0.055; 744 c = Math.min(Math.max(Math.round(255 * c), 0), 255); 745 a = Math.min(Math.max(Math.round(255 * a), 0), 255); 746 b = Math.min(Math.max(Math.round(255 * b), 0), 255); 747 return new axs.utils.Color(c, a, b, 1) 748 }; 749 axs.utils.scalarMultiplyMatrix = function(a, b) { 750 for(var c = [[], [], []], d = 0;3 > d;d++) { 751 for(var e = 0;3 > e;e++) { 752 c[d][e] = a[d][e] * b 753 } 754 } 755 return c 756 }; 757 axs.utils.multiplyMatrices = function(a, b) { 758 for(var c = [[], [], []], d = 0;3 > d;d++) { 759 for(var e = 0;3 > e;e++) { 760 c[d][e] = a[d][0] * b[0][e] + a[d][1] * b[1][e] + a[d][2] * b[2][e] 761 } 762 } 763 return c 764 }; 765 axs.utils.getContrastRatioForElement = function(a) { 766 var b = window.getComputedStyle(a, null); 767 return axs.utils.getContrastRatioForElementWithComputedStyle(b, a) 768 }; 769 axs.utils.getContrastRatioForElementWithComputedStyle = function(a, b) { 770 if(axs.utils.isElementHidden(b)) { 771 return null 772 } 773 var c = axs.utils.getBgColor(a, b); 774 if(!c) { 775 return null 776 } 777 var d = axs.utils.getFgColor(a, b, c); 778 return d ? axs.utils.calculateContrastRatio(d, c) : null 779 }; 780 axs.utils.isNativeTextElement = function(a) { 781 var b = a.tagName.toLowerCase(); 782 a = a.type ? a.type.toLowerCase() : ""; 783 if("textarea" == b) { 784 return!0 785 } 786 if("input" != b) { 787 return!1 788 } 789 switch(a) { 790 case "email": 791 ; 792 case "number": 793 ; 794 case "password": 795 ; 796 case "search": 797 ; 798 case "text": 799 ; 800 case "tel": 801 ; 802 case "url": 803 ; 804 case "": 805 return!0; 806 default: 807 return!1 808 } 809 }; 810 axs.utils.isLowContrast = function(a, b, c) { 811 a = Math.round(10 * a) / 10; 812 return c ? 4.5 > a || !axs.utils.isLargeFont(b) && 7 > a : 3 > a || !axs.utils.isLargeFont(b) && 4.5 > a 813 }; 814 axs.utils.hasLabel = function(a) { 815 var b = a.tagName.toLowerCase(), c = a.type ? a.type.toLowerCase() : ""; 816 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) { 817 return!0 818 } 819 for(b = a.parentElement;b;) { 820 if("label" == b.tagName.toLowerCase() && b.control == a) { 821 return!0 822 } 823 b = b.parentElement 824 } 825 return!1 826 }; 827 axs.utils.isElementHidden = function(a) { 828 if(!(a instanceof a.ownerDocument.defaultView.HTMLElement)) { 829 return!1 830 } 831 if(a.hasAttribute("chromevoxignoreariahidden")) { 832 var b = !0 833 } 834 var c = window.getComputedStyle(a, null); 835 return"none" == c.display || "hidden" == c.visibility ? !0 : a.hasAttribute("aria-hidden") && "true" == a.getAttribute("aria-hidden").toLowerCase() ? !b : !1 836 }; 837 axs.utils.isElementOrAncestorHidden = function(a) { 838 return axs.utils.isElementHidden(a) ? !0 : a.parentElement ? axs.utils.isElementOrAncestorHidden(a.parentElement) : !1 839 }; 840 axs.utils.isInlineElement = function(a) { 841 a = a.tagName.toUpperCase(); 842 return axs.constants.InlineElements[a] 843 }; 844 axs.utils.getRoles = function(a) { 845 if(!a.hasAttribute("role")) { 846 return!1 847 } 848 a = a.getAttribute("role").split(" "); 849 for(var b = [], c = !0, d = 0;d < a.length;d++) { 850 var e = a[d]; 851 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) 852 } 853 return{roles:b, valid:c} 854 }; 855 axs.utils.getAriaPropertyValue = function(a, b, c) { 856 var d = a.replace(/^aria-/, ""), e = axs.constants.ARIA_PROPERTIES[d], d = {name:a, rawValue:b}; 857 if(!e) { 858 return d.valid = !1, d.reason = '"' + a + '" is not a valid ARIA property', d 859 } 860 e = e.valueType; 861 if(!e) { 862 return d.valid = !1, d.reason = '"' + a + '" is not a valid ARIA property', d 863 } 864 switch(e) { 865 case "idref": 866 a = axs.utils.isValidIDRefValue(b, c), d.valid = a.valid, d.reason = a.reason, d.idref = a.idref; 867 case "idref_list": 868 a = b.split(/\s+/); 869 d.valid = !0; 870 for(b = 0;b < a.length;b++) { 871 e = axs.utils.isValidIDRefValue(a[b], c), e.valid || (d.valid = !1), d.values ? d.values.push(e) : d.values = [e] 872 } 873 return d; 874 case "integer": 875 ; 876 case "decimal": 877 c = axs.utils.isValidNumber(b); 878 if(!c.valid) { 879 return d.valid = !1, d.reason = c.reason, d 880 } 881 Math.floor(c.value) != c.value ? (d.valid = !1, d.reason = "" + b + " is not a whole integer") : (d.valid = !0, d.value = c.value); 882 return d; 883 case "number": 884 c = axs.utils.isValidNumber(b), c.valid && (d.valid = !0, d.value = c.value); 885 case "string": 886 return d.valid = !0, d.value = b, d; 887 case "token": 888 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; 889 case "token_list": 890 e = b.split(/\s+/); 891 d.valid = !0; 892 for(b = 0;b < e.length;b++) { 893 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] 894 } 895 return d; 896 case "tristate": 897 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; 898 case "boolean": 899 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 900 } 901 d.valid = !1; 902 d.reason = "Not a valid ARIA property"; 903 return d 904 }; 905 axs.utils.isValidTokenValue = function(a, b) { 906 var c = a.replace(/^aria-/, ""); 907 return axs.utils.isPossibleValue(b, axs.constants.ARIA_PROPERTIES[c].valuesSet, a) 908 }; 909 axs.utils.isPossibleValue = function(a, b, c) { 910 return b[a] ? {valid:!0, value:a} : {valid:!1, value:a, reason:'"' + a + '" is not a valid value for ' + c, possibleValues:Object.keys(b)} 911 }; 912 axs.utils.isValidBoolean = function(a) { 913 try { 914 var b = JSON.parse(a) 915 }catch(c) { 916 b = "" 917 } 918 return"boolean" != typeof b ? {valid:!1, value:a, reason:'"' + a + '" is not a true/false value'} : {valid:!0, value:b} 919 }; 920 axs.utils.isValidIDRefValue = function(a, b) { 921 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 + '"'} 922 }; 923 axs.utils.isValidNumber = function(a) { 924 try { 925 var b = JSON.parse(a) 926 }catch(c) { 927 return{valid:!1, value:a, reason:'"' + a + '" is not a number'} 928 } 929 return"number" != typeof b ? {valid:!1, value:a, reason:'"' + a + '" is not a number'} : {valid:!0, value:b} 930 }; 931 axs.utils.isElementImplicitlyFocusable = function(a) { 932 var b = a.ownerDocument.defaultView; 933 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 934 }; 935 axs.utils.values = function(a) { 936 var b = [], c; 937 for(c in a) { 938 a.hasOwnProperty(c) && "function" != typeof a[c] && b.push(a[c]) 939 } 940 return b 941 }; 942 axs.utils.namedValues = function(a) { 943 var b = {}, c; 944 for(c in a) { 945 a.hasOwnProperty(c) && "function" != typeof a[c] && (b[c] = a[c]) 946 } 947 return b 948 }; 949 axs.utils.getQuerySelectorText = function(a) { 950 if(null == a || "HTML" == a.tagName) { 951 return"html" 952 } 953 if("BODY" == a.tagName) { 954 return"body" 955 } 956 if(a.hasAttribute) { 957 if(a.id) { 958 return"#" + a.id 959 } 960 if(a.className) { 961 for(var b = "", c = 0;c < a.classList.length;c++) { 962 b += "." + a.classList[c] 963 } 964 var d = 0; 965 if(a.parentNode) { 966 for(c = 0;c < a.parentNode.children.length;c++) { 967 var e = a.parentNode.children[c]; 968 axs.browserUtils.matchSelector(e, b) && d++; 969 if(e === a) { 970 break 971 } 972 } 973 }else { 974 d = 1 975 } 976 return 1 == d ? axs.utils.getQuerySelectorText(a.parentNode) + " > " + b : axs.utils.getQuerySelectorText(a.parentNode) + " > " + b + ":nth-of-type(" + d + ")" 977 } 978 if(a.parentNode) { 979 b = a.parentNode.children; 980 d = 1; 981 for(c = 0;b[c] !== a;) { 982 b[c].tagName == a.tagName && d++, c++ 983 } 984 c = ""; 985 "BODY" != a.parentNode.tagName && (c = axs.utils.getQuerySelectorText(a.parentNode) + " > "); 986 return 1 == d ? c + a.tagName : c + a.tagName + ":nth-of-type(" + d + ")" 987 } 988 }else { 989 if(a.selectorText) { 990 return a.selectorText 991 } 992 } 993 return"" 994 }; 995 axs.properties = {}; 996 axs.properties.TEXT_CONTENT_XPATH = './/text()[normalize-space(.)!=""]/parent::*[name()!="script"]'; 997 axs.properties.getFocusProperties = function(a) { 998 var b = {}, c = a.getAttribute("tabindex"); 999 void 0 != c ? b.tabindex = {value:c, valid:!0} : axs.utils.isElementImplicitlyFocusable(a) && (b.implicitlyFocusable = {value:!0, valid:!0}); 1000 if(0 == Object.keys(b).length) { 1001 return null 1002 } 1003 var c = axs.utils.elementIsTransparent(a), d = axs.utils.elementHasZeroArea(a), e = axs.utils.elementIsOutsideScrollArea(a), f = axs.utils.overlappingElements(a); 1004 if(c || d || e || 0 < f.length) { 1005 var g = axs.utils.isElementOrAncestorHidden(a), h = {value:!1, valid:g}; 1006 c && (h.transparent = !0); 1007 d && (h.zeroArea = !0); 1008 e && (h.outsideScrollArea = !0); 1009 0 < f.length && (h.overlappingElements = f); 1010 h.hidden = {value:g, reason:axs.properties.getHiddenReason(a), valid:g}; 1011 b.visible = h 1012 }else { 1013 b.visible = {value:!0, valid:!0} 1014 } 1015 return b 1016 }; 1017 axs.properties.getHiddenReason = function(a) { 1018 if(!(a && a instanceof a.ownerDocument.defaultView.HTMLElement)) { 1019 return null 1020 } 1021 if(a.hasAttribute("chromevoxignoreariahidden")) { 1022 var b = !0 1023 } 1024 var c = window.getComputedStyle(a, null); 1025 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(a.parentElement) 1026 }; 1027 axs.properties.getColorProperties = function(a) { 1028 var b = {}; 1029 (a = axs.properties.getContrastRatioProperties(a)) && (b.contrastRatio = a); 1030 return 0 == Object.keys(b).length ? null : b 1031 }; 1032 axs.properties.hasDirectTextDescendant = function(a) { 1033 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()) { 1034 if(d === a) { 1035 c = !0; 1036 break 1037 } 1038 } 1039 return c 1040 }; 1041 axs.properties.getContrastRatioProperties = function(a) { 1042 if(!axs.properties.hasDirectTextDescendant(a)) { 1043 return null 1044 } 1045 var b = {}, c = window.getComputedStyle(a, null), d = axs.utils.getBgColor(c, a); 1046 if(!d) { 1047 return null 1048 } 1049 b.backgroundColor = axs.utils.colorToString(d); 1050 var e = axs.utils.getFgColor(c, a, d); 1051 b.foregroundColor = axs.utils.colorToString(e); 1052 a = axs.utils.getContrastRatioForElementWithComputedStyle(c, a); 1053 if(!a) { 1054 return null 1055 } 1056 b.value = a.toFixed(2); 1057 axs.utils.isLowContrast(a, c) && (b.alert = !0); 1058 (c = axs.utils.suggestColors(d, e, a, c)) && Object.keys(c).length && (b.suggestedColors = c); 1059 return b 1060 }; 1061 axs.properties.findTextAlternatives = function(a, b, c) { 1062 var d = c || !1; 1063 c = axs.utils.asElement(a); 1064 if(!c || !d && axs.utils.isElementOrAncestorHidden(c)) { 1065 return null 1066 } 1067 if(a.nodeType == Node.TEXT_NODE) { 1068 return c = {type:"text"}, c.text = a.textContent, c.lastWord = axs.properties.getLastWord(c.text), b.content = c, a.textContent 1069 } 1070 a = null; 1071 d || (a = axs.properties.getTextFromAriaLabelledby(c, b)); 1072 if(c.hasAttribute("aria-label")) { 1073 var e = {type:"text"}; 1074 e.text = c.getAttribute("aria-label"); 1075 e.lastWord = axs.properties.getLastWord(e.text); 1076 a ? e.unused = !0 : d && axs.utils.elementIsHtmlControl(c) || (a = e.text); 1077 b.ariaLabel = e 1078 } 1079 c.hasAttribute("role") && "presentation" == c.getAttribute("role") || (a = axs.properties.getTextFromHostLanguageAttributes(c, b, a)); 1080 if(d && axs.utils.elementIsHtmlControl(c)) { 1081 e = c.ownerDocument.defaultView; 1082 if(c instanceof e.HTMLInputElement) { 1083 var f = c; 1084 "text" == f.type && f.value && 0 < f.value.length && (b.controlValue = {text:f.value}); 1085 "range" == f.type && (b.controlValue = {text:f.value}) 1086 } 1087 c instanceof e.HTMLSelectElement && (b.controlValue = {text:c.value}); 1088 b.controlValue && (e = b.controlValue, a ? e.unused = !0 : a = e.text) 1089 } 1090 if(d && axs.utils.elementIsAriaWidget(c)) { 1091 d = c.getAttribute("role"); 1092 "textbox" == d && c.textContent && 0 < c.textContent.length && (b.controlValue = {text:c.textContent}); 1093 if("slider" == d || "spinbutton" == d) { 1094 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")}) 1095 } 1096 if("menu" == d) { 1097 for(var g = c.querySelectorAll("[role=menuitemcheckbox], [role=menuitemradio]"), e = [], f = 0;f < g.length;f++) { 1098 "true" == g[f].getAttribute("aria-checked") && e.push(g[f]) 1099 } 1100 if(0 < e.length) { 1101 g = ""; 1102 for(f = 0;f < e.length;f++) { 1103 g += axs.properties.findTextAlternatives(e[f], {}, !0), f < e.length - 1 && (g += ", ") 1104 } 1105 b.controlValue = {text:g} 1106 } 1107 } 1108 if("combobox" == d || "select" == d) { 1109 b.controlValue = {text:"TODO"} 1110 } 1111 b.controlValue && (e = b.controlValue, a ? e.unused = !0 : a = e.text) 1112 } 1113 e = !0; 1114 c.hasAttribute("role") && (d = c.getAttribute("role"), (d = axs.constants.ARIA_ROLES[d]) && (!d.namefrom || 0 > d.namefrom.indexOf("contents")) && (e = !1)); 1115 (d = axs.properties.getTextFromDescendantContent(c)) && e && (e = {type:"text"}, e.text = d, e.lastWord = axs.properties.getLastWord(e.text), a ? e.unused = !0 : a = d, b.content = e); 1116 c.hasAttribute("title") && (d = {type:"string", valid:!0}, d.text = c.getAttribute("title"), d.lastWord = axs.properties.getLastWord(d.lastWord), a ? d.unused = !0 : a = d.text, b.title = d); 1117 return 0 == Object.keys(b).length && null == a ? null : a 1118 }; 1119 axs.properties.getTextFromDescendantContent = function(a) { 1120 a = a.childNodes; 1121 for(var b = [], c = 0;c < a.length;c++) { 1122 var d = axs.properties.findTextAlternatives(a[c], {}, !0); 1123 d && 0 < d.trim().length && b.push(d.trim()) 1124 } 1125 return b.length ? b.join(" ") : null 1126 }; 1127 axs.properties.getTextFromAriaLabelledby = function(a, b) { 1128 var c = null; 1129 if(!a.hasAttribute("aria-labelledby")) { 1130 return c 1131 } 1132 for(var d = a.getAttribute("aria-labelledby").split(/\s+/), e = {valid:!0}, f = [], g = [], h = 0;h < d.length;h++) { 1133 var k = {type:"element"}, m = d[h]; 1134 k.value = m; 1135 var l = document.getElementById(m); 1136 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]}); 1137 g.push(k) 1138 } 1139 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); 1140 return c 1141 }; 1142 axs.properties.getTextFromHostLanguageAttributes = function(a, b, c) { 1143 if(axs.browserUtils.matchSelector(a, "img")) { 1144 if(a.hasAttribute("alt")) { 1145 var d = {type:"string", valid:!0}; 1146 d.text = a.getAttribute("alt"); 1147 c ? d.unused = !0 : c = d.text; 1148 b.alt = d 1149 }else { 1150 d = {valid:!1, errorMessage:"No alt value provided"}, b.alt = d, d = a.src, "string" == typeof d && (c = d.split("/").pop(), b.filename = {text:c}) 1151 } 1152 } 1153 if(axs.browserUtils.matchSelector(a, 'input:not([type="hidden"]):not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), video:not([disabled])')) { 1154 if(a.hasAttribute("id")) { 1155 for(var d = document.querySelectorAll('label[for="' + a.id + '"]'), e = {}, f = [], g = [], h = 0;h < d.length;h++) { 1156 var k = {type:"element"}, m = d[h], l = axs.properties.findTextAlternatives(m, {}, !0); 1157 l && 0 < l.trim().length && (k.text = l.trim(), g.push(l.trim())); 1158 k.element = m; 1159 f.push(k) 1160 } 1161 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) 1162 } 1163 d = a.parentElement; 1164 for(e = {};d;) { 1165 if("label" == d.tagName.toLowerCase() && (f = d, f.control == a)) { 1166 e.type = "element"; 1167 e.text = axs.properties.findTextAlternatives(f, {}, !0); 1168 e.lastWord = axs.properties.getLastWord(e.text); 1169 e.element = f; 1170 break 1171 } 1172 d = d.parentElement 1173 } 1174 e.text && (c ? e.unused = !0 : c = e.text, b.labelWrapped = e); 1175 Object.keys(b).length || (b.noLabel = !0) 1176 } 1177 return c 1178 }; 1179 axs.properties.getLastWord = function(a) { 1180 if(!a) { 1181 return null 1182 } 1183 var b = a.lastIndexOf(" ") + 1, c = a.length - 10; 1184 return a.substring(b > c ? b : c) 1185 }; 1186 axs.properties.getTextProperties = function(a) { 1187 var b = {}; 1188 a = axs.properties.findTextAlternatives(a, b); 1189 if(0 == Object.keys(b).length) { 1190 if(!a) { 1191 return null 1192 } 1193 b.hasProperties = !1 1194 }else { 1195 b.hasProperties = !0 1196 } 1197 b.computedText = a; 1198 b.lastWord = axs.properties.getLastWord(a); 1199 return b 1200 }; 1201 axs.properties.getAriaProperties = function(a) { 1202 var b = {}, c = axs.properties.getGlobalAriaProperties(a), d; 1203 for(d in axs.constants.ARIA_PROPERTIES) { 1204 var e = "aria-" + d; 1205 if(a.hasAttribute(e)) { 1206 var f = a.getAttribute(e); 1207 c[e] = axs.utils.getAriaPropertyValue(e, f, a) 1208 } 1209 } 1210 0 < Object.keys(c).length && (b.properties = axs.utils.values(c)); 1211 f = axs.utils.getRoles(a); 1212 if(!f) { 1213 return Object.keys(b).length ? b : null 1214 } 1215 b.roles = f; 1216 if(!f.valid || !f.roles) { 1217 return b 1218 } 1219 for(var e = f.roles, g = 0;g < e.length;g++) { 1220 var h = e[g]; 1221 if(h.details && h.details.propertiesSet) { 1222 for(d in h.details.propertiesSet) { 1223 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"})) 1224 } 1225 } 1226 } 1227 0 < Object.keys(c).length && (b.properties = axs.utils.values(c)); 1228 return 0 < Object.keys(b).length ? b : null 1229 }; 1230 axs.properties.getGlobalAriaProperties = function(a) { 1231 for(var b = {}, c = 0;c < axs.constants.GLOBAL_PROPERTIES.length;c++) { 1232 var d = axs.constants.GLOBAL_PROPERTIES[c]; 1233 if(a.hasAttribute(d)) { 1234 var e = a.getAttribute(d); 1235 b[d] = axs.utils.getAriaPropertyValue(d, e, a) 1236 } 1237 } 1238 return b 1239 }; 1240 axs.properties.getVideoProperties = function(a) { 1241 if(!axs.browserUtils.matchSelector(a, "video")) { 1242 return null 1243 } 1244 var b = {}; 1245 b.captionTracks = axs.properties.getTrackElements(a, "captions"); 1246 b.descriptionTracks = axs.properties.getTrackElements(a, "descriptions"); 1247 b.chapterTracks = axs.properties.getTrackElements(a, "chapters"); 1248 return b 1249 }; 1250 axs.properties.getTrackElements = function(a, b) { 1251 var c = a.querySelectorAll("track[kind=" + b + "]"), d = {}; 1252 if(!c.length) { 1253 return d.valid = !1, d.reason = {messageKey:"noTracksProvided", args:[[b]]}, d 1254 } 1255 d.valid = !0; 1256 for(var e = [], f = 0;f < c.length;f++) { 1257 var g = {}, h = c[f].getAttribute("src"), k = c[f].getAttribute("srcLang"), m = c[f].getAttribute("label"); 1258 h ? (g.valid = !0, g.src = h) : (g.valid = !1, g.reason = {messageKey:"noSrcProvided"}); 1259 h = ""; 1260 m && (h += m, k && (h += " ")); 1261 k && (h += "(" + k + ")"); 1262 "" == h && (h = "[[object Object]]"); 1263 g.name = h; 1264 e.push(g) 1265 } 1266 d.values = e; 1267 return d 1268 }; 1269 axs.properties.getAllProperties = function(a) { 1270 var b = axs.utils.asElement(a); 1271 if(!b) { 1272 return{} 1273 } 1274 var c = {}; 1275 c.ariaProperties = axs.properties.getAriaProperties(b); 1276 c.colorProperties = axs.properties.getColorProperties(b); 1277 c.focusProperties = axs.properties.getFocusProperties(b); 1278 c.textProperties = axs.properties.getTextProperties(a); 1279 c.videoProperties = axs.properties.getVideoProperties(b); 1280 return c 1281 }; 1282 axs.AuditRule = function(a) { 1283 for(var b = !0, c = [], d = 0;d < axs.AuditRule.requiredFields.length;d++) { 1284 var e = axs.AuditRule.requiredFields[d]; 1285 e in a || (b = !1, c.push(e)) 1286 } 1287 if(!b) { 1288 throw"Invalid spec; the following fields were not specified: " + c.join(", ") + "\n" + JSON.stringify(a); 1289 } 1290 this.name = a.name; 1291 this.severity = a.severity; 1292 this.relevantElementMatcher_ = a.relevantElementMatcher; 1293 this.test_ = a.test; 1294 this.code = a.code; 1295 this.heading = a.heading || ""; 1296 this.url = a.url || ""; 1297 this.requiresConsoleAPI = !!a.opt_requiresConsoleAPI 1298 }; 1299 axs.AuditRule.requiredFields = "name severity relevantElementMatcher test code heading".split(" "); 1300 axs.AuditRule.NOT_APPLICABLE = {result:axs.constants.AuditResult.NA}; 1301 axs.AuditRule.prototype.addElement = function(a, b) { 1302 a.push(b) 1303 }; 1304 axs.AuditRule.collectMatchingElements = function(a, b, c) { 1305 if(a.nodeType == Node.ELEMENT_NODE) { 1306 var d = a 1307 } 1308 d && b.call(null, d) && c.push(d); 1309 for(a = a.firstChild;null != a;) { 1310 axs.AuditRule.collectMatchingElements(a, b, c), a = a.nextSibling 1311 } 1312 }; 1313 axs.AuditRule.prototype.run = function(a) { 1314 a = a || {}; 1315 var b = "ignoreSelectors" in a ? a.ignoreSelectors : [], c = "maxResults" in a ? a.maxResults : null, d = []; 1316 axs.AuditRule.collectMatchingElements("scope" in a ? a.scope : document, this.relevantElementMatcher_, d); 1317 var e = []; 1318 if(!d.length) { 1319 return{result:axs.constants.AuditResult.NA} 1320 } 1321 for(a = 0;a < d.length && !(null != c && e.length >= c);a++) { 1322 var f = d[a], g; 1323 a: { 1324 g = f; 1325 for(var h = 0;h < b.length;h++) { 1326 if(axs.browserUtils.matchSelector(g, b[h])) { 1327 g = !0; 1328 break a 1329 } 1330 } 1331 g = !1 1332 } 1333 !g && this.test_(f) && this.addElement(e, f) 1334 } 1335 b = {result:e.length ? axs.constants.AuditResult.FAIL : axs.constants.AuditResult.PASS, elements:e}; 1336 a < d.length && (b.resultsTruncated = !0); 1337 return b 1338 }; 1339 axs.AuditRule.specs = {}; 1340 axs.AuditRules = {}; 1341 axs.AuditRules.getRule = function(a) { 1342 if(!axs.AuditRules.rules) { 1343 axs.AuditRules.rules = {}; 1344 for(var b in axs.AuditRule.specs) { 1345 var c = axs.AuditRule.specs[b], d = new axs.AuditRule(c); 1346 axs.AuditRules.rules[c.name] = d 1347 } 1348 } 1349 return axs.AuditRules.rules[a] 1350 }; 1351 axs.AuditResults = function() { 1352 this.errors_ = []; 1353 this.warnings_ = [] 1354 }; 1355 goog.exportSymbol("axs.AuditResults", axs.AuditResults); 1356 axs.AuditResults.prototype.addError = function(a) { 1357 "" != a && this.errors_.push(a) 1358 }; 1359 goog.exportProperty(axs.AuditResults.prototype, "addError", axs.AuditResults.prototype.addError); 1360 axs.AuditResults.prototype.addWarning = function(a) { 1361 "" != a && this.warnings_.push(a) 1362 }; 1363 goog.exportProperty(axs.AuditResults.prototype, "addWarning", axs.AuditResults.prototype.addWarning); 1364 axs.AuditResults.prototype.numErrors = function() { 1365 return this.errors_.length 1366 }; 1367 goog.exportProperty(axs.AuditResults.prototype, "numErrors", axs.AuditResults.prototype.numErrors); 1368 axs.AuditResults.prototype.numWarnings = function() { 1369 return this.warnings_.length 1370 }; 1371 goog.exportProperty(axs.AuditResults.prototype, "numWarnings", axs.AuditResults.prototype.numWarnings); 1372 axs.AuditResults.prototype.getErrors = function() { 1373 return this.errors_ 1374 }; 1375 goog.exportProperty(axs.AuditResults.prototype, "getErrors", axs.AuditResults.prototype.getErrors); 1376 axs.AuditResults.prototype.getWarnings = function() { 1377 return this.warnings_ 1378 }; 1379 goog.exportProperty(axs.AuditResults.prototype, "getWarnings", axs.AuditResults.prototype.getWarnings); 1380 axs.AuditResults.prototype.toString = function() { 1381 for(var a = "", b = 0;b < this.errors_.length;b++) { 1382 0 == b && (a += "\nErrors:\n"); 1383 var c = this.errors_[b], a = a + (c + "\n\n") 1384 } 1385 for(b = 0;b < this.warnings_.length;b++) { 1386 0 == b && (a += "\nWarnings:\n"), c = this.warnings_[b], a += c + "\n\n" 1387 } 1388 return a 1389 }; 1390 goog.exportProperty(axs.AuditResults.prototype, "toString", axs.AuditResults.prototype.toString); 1391 axs.Audit = {}; 1392 axs.AuditConfiguration = function() { 1393 this.rules_ = {}; 1394 this.maxResults = this.auditRulesToIgnore = this.auditRulesToRun = this.scope = null; 1395 this.withConsoleApi = !1; 1396 goog.exportProperty(this, "scope", this.scope); 1397 goog.exportProperty(this, "auditRulesToRun", this.auditRulesToRun); 1398 goog.exportProperty(this, "auditRulesToIgnore", this.auditRulesToIgnore); 1399 goog.exportProperty(this, "withConsoleApi", this.withConsoleApi) 1400 }; 1401 goog.exportSymbol("axs.AuditConfiguration", axs.AuditConfiguration); 1402 axs.AuditConfiguration.prototype = {ignoreSelectors:function(a, b) { 1403 a in this.rules_ || (this.rules_[a] = {}); 1404 "ignore" in this.rules_[a] || (this.rules_[a].ignore = []); 1405 Array.prototype.push.call(this.rules_[a].ignore, b) 1406 }, getIgnoreSelectors:function(a) { 1407 return a in this.rules_ && "ignore" in this.rules_[a] ? this.rules_[a].ignore : [] 1408 }, setSeverity:function(a, b) { 1409 a in this.rules_ || (this.rules_[a] = {}); 1410 this.rules_[a].severity = b 1411 }, getSeverity:function(a) { 1412 return a in this.rules_ && "severity" in this.rules_[a] ? this.rules_[a].severity : null 1413 }}; 1414 goog.exportProperty(axs.AuditConfiguration.prototype, "ignoreSelectors", axs.AuditConfiguration.prototype.ignoreSelectors); 1415 goog.exportProperty(axs.AuditConfiguration.prototype, "getIgnoreSelectors", axs.AuditConfiguration.prototype.getIgnoreSelectors); 1416 axs.Audit.run = function(a) { 1417 a = a || new axs.AuditConfiguration; 1418 var b = a.withConsoleApi, c = [], d; 1419 d = a.auditRulesToRun && 0 < a.auditRulesToRun.length ? a.auditRulesToRun : Object.keys(axs.AuditRule.specs); 1420 if(a.auditRulesToIgnore) { 1421 for(var e = 0;e < a.auditRulesToIgnore.length;e++) { 1422 var f = a.auditRulesToIgnore[e]; 1423 0 > d.indexOf(f) || d.splice(d.indexOf(f), 1) 1424 } 1425 } 1426 for(e = 0;e < d.length;e++) { 1427 var f = d[e], g = axs.AuditRules.getRule(f); 1428 if(g && !g.disabled && (b || !g.requiresConsoleAPI)) { 1429 var h = {}, k = a.getIgnoreSelectors(g.name); 1430 if(0 < k.length || a.scope) { 1431 h.ignoreSelectors = k 1432 } 1433 a.scope && (h.scope = a.scope); 1434 a.maxResults && (h.maxResults = a.maxResults); 1435 h = g.run.call(g, h); 1436 g = axs.utils.namedValues(g); 1437 g.severity = a.getSeverity(f) || g.severity; 1438 h.rule = g; 1439 c.push(h) 1440 } 1441 } 1442 return c 1443 }; 1444 goog.exportSymbol("axs.Audit.run", axs.Audit.run); 1445 axs.Audit.auditResults = function(a) { 1446 for(var b = new axs.AuditResults, c = 0;c < a.length;c++) { 1447 var d = a[c]; 1448 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))) 1449 } 1450 return b 1451 }; 1452 goog.exportSymbol("axs.Audit.auditResults", axs.Audit.auditResults); 1453 axs.Audit.createReport = function(a, b) { 1454 var c; 1455 c = "*** Begin accessibility audit results ***\nAn accessibility audit found " + axs.Audit.auditResults(a).toString(); 1456 b && (c += "\nFor more information, please see ", c += b); 1457 return c += "\n*** End accessibility audit results ***" 1458 }; 1459 goog.exportSymbol("axs.Audit.createReport", axs.Audit.createReport); 1460 axs.Audit.accessibilityErrorMessage = function(a) { 1461 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++) { 1462 var e = a.elements[d], b = b + "\n"; 1463 try { 1464 b += axs.utils.getQuerySelectorText(e) 1465 }catch(f) { 1466 b += " tagName:" + e.tagName, b += " id:" + e.id 1467 } 1468 } 1469 "" != a.rule.url && (b += "\nSee " + a.rule.url + " for more information."); 1470 return b 1471 }; 1472 goog.exportSymbol("axs.Audit.accessibilityErrorMessage", axs.Audit.accessibilityErrorMessage); 1473 axs.AuditRule.specs.audioWithoutControls = {name:"audioWithoutControls", heading:"Audio elements should have controls", url:"", severity:axs.constants.Severity.WARNING, relevantElementMatcher:function(a) { 1474 return axs.browserUtils.matchSelector(a, "audio[autoplay]") 1475 }, test:function(a) { 1476 return!a.querySelectorAll("[controls]").length && 3 < a.duration 1477 }, code:"AX_AUDIO_01"}; 1478 axs.AuditRule.specs.badAriaAttributeValue = {name:"badAriaAttributeValue", heading:"ARIA state and property values must be valid", url:"", severity:axs.constants.Severity.SEVERE, relevantElementMatcher:function(a) { 1479 var b = "", c; 1480 for(c in axs.constants.ARIA_PROPERTIES) { 1481 b += "[aria-" + c + "]," 1482 } 1483 b = b.substring(0, b.length - 1); 1484 return axs.browserUtils.matchSelector(a, b) 1485 }, test:function(a) { 1486 for(var b in axs.constants.ARIA_PROPERTIES) { 1487 var c = "aria-" + b; 1488 if(a.hasAttribute(c)) { 1489 var d = a.getAttribute(c); 1490 if(!axs.utils.getAriaPropertyValue(c, d, a).valid) { 1491 return!0 1492 } 1493 } 1494 } 1495 return!1 1496 }, code:"AX_ARIA_04"}; 1497 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) { 1498 return axs.browserUtils.matchSelector(a, "[role]") 1499 }, test:function(a) { 1500 return!axs.utils.getRoles(a).valid 1501 }, code:"AX_ARIA_01"}; 1502 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) { 1503 if(!axs.browserUtils.matchSelector(a, 'input:not([type="hidden"]):not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), video:not([disabled])')) { 1504 return!1 1505 } 1506 if(0 <= a.tabIndex) { 1507 return!0 1508 } 1509 for(a = a.parentElement;null != a;a = a.parentElement) { 1510 if(axs.utils.elementIsAriaWidget(a)) { 1511 return!1 1512 } 1513 } 1514 return!0 1515 }, test:function(a) { 1516 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 1517 }, code:"AX_TEXT_01", ruleName:"Controls and media elements should have labels"}; 1518 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) { 1519 if(!axs.browserUtils.matchSelector(a, axs.utils.FOCUSABLE_ELEMENTS_SELECTOR)) { 1520 return!1 1521 } 1522 if(0 <= a.tabIndex) { 1523 return!0 1524 } 1525 for(a = a.parentElement;null != a;a = a.parentElement) { 1526 if(axs.utils.elementIsAriaWidget(a)) { 1527 return!1 1528 } 1529 } 1530 return!0 1531 }, test:function(a) { 1532 return axs.utils.isElementOrAncestorHidden(a) ? !1 : !axs.utils.elementIsVisible(a) 1533 }, code:"AX_FOCUS_01"}; 1534 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) { 1535 return axs.browserUtils.matchSelector(a, "img") && !axs.utils.isElementOrAncestorHidden(a) 1536 }, test:function(a) { 1537 return!a.hasAttribute("alt") && "presentation" != a.getAttribute("role") 1538 }, code:"AX_TEXT_02"}; 1539 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) { 1540 return axs.browserUtils.matchSelector(a, "a") 1541 }, test:function(a) { 1542 return/^\s*click\s*here\s*[^a-z]?$/i.test(a.textContent) 1543 }, code:"AX_TITLE_01"}; 1544 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) { 1545 return axs.properties.hasDirectTextDescendant(a) 1546 }, test:function(a) { 1547 var b = window.getComputedStyle(a, null); 1548 return(a = axs.utils.getContrastRatioForElementWithComputedStyle(b, a)) && axs.utils.isLowContrast(a, b) 1549 }, code:"AX_COLOR_01"}; 1550 axs.AuditRule.specs.mainRoleOnInappropriateElement = {name:"mainRoleOnInappropriateElement", heading:"role=main should only appear on significant elements", url:"", severity:axs.constants.Severity.WARNING, relevantElementMatcher:function(a) { 1551 return axs.browserUtils.matchSelector(a, "[role~=main]") 1552 }, test:function(a) { 1553 if(axs.utils.isInlineElement(a)) { 1554 return!0 1555 } 1556 a = axs.properties.getTextFromDescendantContent(a); 1557 return!a || 50 > a.length ? !0 : !1 1558 }, code:"AX_ARIA_04"}; 1559 axs.AuditRule.specs.elementsWithMeaningfulBackgroundImage = {name:"elementsWithMeaningfulBackgroundImage", severity:axs.constants.Severity.WARNING, relevantElementMatcher:function(a) { 1560 return!axs.utils.isElementOrAncestorHidden(a) 1561 }, 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) { 1562 if(a.textContent && 0 < a.textContent.length) { 1563 return!1 1564 } 1565 a = window.getComputedStyle(a, null); 1566 var b = a.backgroundImage; 1567 if(!b || "undefined" === b || "none" === b || 0 != b.indexOf("url")) { 1568 return!1 1569 } 1570 b = parseInt(a.width, 10); 1571 a = parseInt(a.height, 10); 1572 return 150 > b && 150 > a 1573 }, code:"AX_IMAGE_01"}; 1574 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) { 1575 return axs.browserUtils.matchSelector(a, "[aria-labelledby]") 1576 }, test:function(a) { 1577 a = a.getAttribute("aria-labelledby").split(/\s+/); 1578 for(var b = 0;b < a.length;b++) { 1579 if(!document.getElementById(a[b])) { 1580 return!0 1581 } 1582 } 1583 return!1 1584 }, code:"AX_ARIA_02"}; 1585 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) { 1586 return"html" == a.tagName.toLowerCase() 1587 }, test:function(a) { 1588 a = a.querySelector("head"); 1589 return a ? (a = a.querySelector("title")) ? !a.textContent : !0 : !0 1590 }, code:"AX_TITLE_01"}; 1591 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) { 1592 return axs.browserUtils.matchSelector(a, "[role]") 1593 }, test:function(a) { 1594 var b = axs.utils.getRoles(a); 1595 if(!b.valid) { 1596 return!1 1597 } 1598 for(var c = 0;c < b.roles.length;c++) { 1599 var d = b.roles[c].details.requiredPropertiesSet, e; 1600 for(e in d) { 1601 if(d = e.replace(/^aria-/, ""), !("defaultValue" in axs.constants.ARIA_PROPERTIES[d] || a.hasAttribute(e))) { 1602 return!0 1603 } 1604 } 1605 } 1606 }, code:"AX_ARIA_03"}; 1607 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) { 1608 return a instanceof a.ownerDocument.defaultView.HTMLBodyElement || axs.utils.isElementOrAncestorHidden(a) ? !1 : "click" in getEventListeners(a) ? !0 : !1 1609 }, test:function(a) { 1610 return!a.hasAttribute("tabindex") && !axs.utils.isElementImplicitlyFocusable(a) 1611 }, code:"AX_FOCUS_02"}; 1612 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) { 1613 return axs.browserUtils.matchSelector(a, "video") 1614 }, test:function(a) { 1615 return!a.querySelectorAll("track[kind=captions]").length 1616 }, code:"AX_VIDEO_01"}; 1617 1618 1619