Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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/t ree/1932e35896baf576c64ec8ddade00cfb68f81610 | |
| 17 * | |
| 18 * See project README for build steps. | |
| 19 */ | |
| 20 // AUTO-GENERATED CONTENT BELOW: DO NOT EDIT! See above for details. | |
|
szager
2013/09/05 19:27:42
Might want a blank line before and after // AUTO-G
aboxhall
2013/09/06 18:26:30
Done.
| |
| 21 var COMPILED = !0, goog = goog || {}; | |
| 22 goog.global = this; | |
| 23 goog.exportPath_ = function(a, b, c) { | |
| 24 a = a.split("."); | |
| 25 c = c || goog.global; | |
| 26 a[0] in c || !c.execScript || c.execScript("var " + a[0]); | |
| 27 for(var d;a.length && (d = a.shift());) { | |
| 28 a.length || void 0 === b ? c = c[d] ? c[d] : c[d] = {} : c[d] = b | |
| 29 } | |
| 30 }; | |
| 31 goog.define = function(a, b) { | |
| 32 var c = b; | |
| 33 COMPILED || goog.global.CLOSURE_DEFINES && Object.prototype.hasOwnProperty.cal l(goog.global.CLOSURE_DEFINES, a) && (c = goog.global.CLOSURE_DEFINES[a]); | |
| 34 goog.exportPath_(a, c) | |
| 35 }; | |
| 36 goog.DEBUG = !0; | |
| 37 goog.LOCALE = "en"; | |
| 38 goog.TRUSTED_SITE = !0; | |
| 39 goog.provide = function(a) { | |
| 40 if(!COMPILED) { | |
| 41 if(goog.isProvided_(a)) { | |
| 42 throw Error('Namespace "' + a + '" already declared.'); | |
| 43 } | |
| 44 delete goog.implicitNamespaces_[a]; | |
| 45 for(var b = a;(b = b.substring(0, b.lastIndexOf("."))) && !goog.getObjectByN ame(b);) { | |
| 46 goog.implicitNamespaces_[b] = !0 | |
| 47 } | |
| 48 } | |
| 49 goog.exportPath_(a) | |
| 50 }; | |
| 51 goog.setTestOnly = function(a) { | |
| 52 if(COMPILED && !goog.DEBUG) { | |
| 53 throw a = a || "", Error("Importing test-only code into non-debug environmen t" + a ? ": " + a : "."); | |
| 54 } | |
| 55 }; | |
| 56 COMPILED || (goog.isProvided_ = function(a) { | |
| 57 return!goog.implicitNamespaces_[a] && !!goog.getObjectByName(a) | |
| 58 }, goog.implicitNamespaces_ = {}); | |
| 59 goog.getObjectByName = function(a, b) { | |
| 60 for(var c = a.split("."), d = b || goog.global, e;e = c.shift();) { | |
| 61 if(goog.isDefAndNotNull(d[e])) { | |
| 62 d = d[e] | |
| 63 }else { | |
| 64 return null | |
| 65 } | |
| 66 } | |
| 67 return d | |
| 68 }; | |
| 69 goog.globalize = function(a, b) { | |
| 70 var c = b || goog.global, d; | |
| 71 for(d in a) { | |
| 72 c[d] = a[d] | |
| 73 } | |
| 74 }; | |
| 75 goog.addDependency = function(a, b, c) { | |
| 76 if(goog.DEPENDENCIES_ENABLED) { | |
| 77 var d; | |
| 78 a = a.replace(/\\/g, "/"); | |
| 79 for(var e = goog.dependencies_, f = 0;d = b[f];f++) { | |
| 80 e.nameToPath[d] = a, a in e.pathToNames || (e.pathToNames[a] = {}), e.path ToNames[a][d] = !0 | |
| 81 } | |
| 82 for(d = 0;b = c[d];d++) { | |
| 83 a in e.requires || (e.requires[a] = {}), e.requires[a][b] = !0 | |
| 84 } | |
| 85 } | |
| 86 }; | |
| 87 goog.ENABLE_DEBUG_LOADER = !0; | |
| 88 goog.require = function(a) { | |
| 89 if(!COMPILED && !goog.isProvided_(a)) { | |
| 90 if(goog.ENABLE_DEBUG_LOADER) { | |
| 91 var b = goog.getPathFromDeps_(a); | |
| 92 if(b) { | |
| 93 goog.included_[b] = !0; | |
| 94 goog.writeScripts_(); | |
| 95 return | |
| 96 } | |
| 97 } | |
| 98 a = "goog.require could not find: " + a; | |
| 99 goog.global.console && goog.global.console.error(a); | |
| 100 throw Error(a); | |
| 101 } | |
| 102 }; | |
| 103 goog.basePath = ""; | |
| 104 goog.nullFunction = function() { | |
| 105 }; | |
| 106 goog.identityFunction = function(a, b) { | |
| 107 return a | |
| 108 }; | |
| 109 goog.abstractMethod = function() { | |
| 110 throw Error("unimplemented abstract method"); | |
| 111 }; | |
| 112 goog.addSingletonGetter = function(a) { | |
| 113 a.getInstance = function() { | |
| 114 if(a.instance_) { | |
| 115 return a.instance_ | |
| 116 } | |
| 117 goog.DEBUG && (goog.instantiatedSingletons_[goog.instantiatedSingletons_.len gth] = a); | |
| 118 return a.instance_ = new a | |
| 119 } | |
| 120 }; | |
| 121 goog.instantiatedSingletons_ = []; | |
| 122 goog.DEPENDENCIES_ENABLED = !COMPILED && goog.ENABLE_DEBUG_LOADER; | |
| 123 goog.DEPENDENCIES_ENABLED && (goog.included_ = {}, goog.dependencies_ = {pathToN ames:{}, nameToPath:{}, requires:{}, visited:{}, written:{}}, goog.inHtmlDocumen t_ = function() { | |
| 124 var a = goog.global.document; | |
| 125 return"undefined" != typeof a && "write" in a | |
| 126 }, goog.findBasePath_ = function() { | |
| 127 if(goog.global.CLOSURE_BASE_PATH) { | |
| 128 goog.basePath = goog.global.CLOSURE_BASE_PATH | |
| 129 }else { | |
| 130 if(goog.inHtmlDocument_()) { | |
| 131 for(var a = goog.global.document.getElementsByTagName("script"), b = a.len gth - 1;0 <= b;--b) { | |
| 132 var c = a[b].src, d = c.lastIndexOf("?"), d = -1 == d ? c.length : d; | |
| 133 if("base.js" == c.substr(d - 7, 7)) { | |
| 134 goog.basePath = c.substr(0, d - 7); | |
| 135 break | |
| 136 } | |
| 137 } | |
| 138 } | |
| 139 } | |
| 140 }, goog.importScript_ = function(a) { | |
| 141 var b = goog.global.CLOSURE_IMPORT_SCRIPT || goog.writeScriptTag_; | |
| 142 !goog.dependencies_.written[a] && b(a) && (goog.dependencies_.written[a] = !0) | |
| 143 }, goog.writeScriptTag_ = function(a) { | |
| 144 if(goog.inHtmlDocument_()) { | |
| 145 var b = goog.global.document; | |
| 146 if("complete" == b.readyState) { | |
| 147 if(/\bdeps.js$/.test(a)) { | |
| 148 return!1 | |
| 149 } | |
| 150 throw Error('Cannot write "' + a + '" after document load'); | |
| 151 } | |
| 152 b.write('<script type="text/javascript" src="' + a + '">\x3c/script>'); | |
| 153 return!0 | |
| 154 } | |
| 155 return!1 | |
| 156 }, goog.writeScripts_ = function() { | |
| 157 function a(e) { | |
| 158 if(!(e in d.written)) { | |
| 159 if(!(e in d.visited) && (d.visited[e] = !0, e in d.requires)) { | |
| 160 for(var g in d.requires[e]) { | |
| 161 if(!goog.isProvided_(g)) { | |
| 162 if(g in d.nameToPath) { | |
| 163 a(d.nameToPath[g]) | |
| 164 }else { | |
| 165 throw Error("Undefined nameToPath for " + g); | |
| 166 } | |
| 167 } | |
| 168 } | |
| 169 } | |
| 170 e in c || (c[e] = !0, b.push(e)) | |
| 171 } | |
| 172 } | |
| 173 var b = [], c = {}, d = goog.dependencies_, e; | |
| 174 for(e in goog.included_) { | |
| 175 d.written[e] || a(e) | |
| 176 } | |
| 177 for(e = 0;e < b.length;e++) { | |
| 178 if(b[e]) { | |
| 179 goog.importScript_(goog.basePath + b[e]) | |
| 180 }else { | |
| 181 throw Error("Undefined script input"); | |
| 182 } | |
| 183 } | |
| 184 }, goog.getPathFromDeps_ = function(a) { | |
| 185 return a in goog.dependencies_.nameToPath ? goog.dependencies_.nameToPath[a] : null | |
| 186 }, goog.findBasePath_(), goog.global.CLOSURE_NO_DEPS || goog.importScript_(goog. basePath + "deps.js")); | |
| 187 goog.typeOf = function(a) { | |
| 188 var b = typeof a; | |
| 189 if("object" == b) { | |
| 190 if(a) { | |
| 191 if(a instanceof Array) { | |
| 192 return"array" | |
| 193 } | |
| 194 if(a instanceof Object) { | |
| 195 return b | |
| 196 } | |
| 197 var c = Object.prototype.toString.call(a); | |
| 198 if("[object Window]" == c) { | |
| 199 return"object" | |
| 200 } | |
| 201 if("[object Array]" == c || "number" == typeof a.length && "undefined" != typeof a.splice && "undefined" != typeof a.propertyIsEnumerable && !a.propertyIs Enumerable("splice")) { | |
| 202 return"array" | |
| 203 } | |
| 204 if("[object Function]" == c || "undefined" != typeof a.call && "undefined" != typeof a.propertyIsEnumerable && !a.propertyIsEnumerable("call")) { | |
| 205 return"function" | |
| 206 } | |
| 207 }else { | |
| 208 return"null" | |
| 209 } | |
| 210 }else { | |
| 211 if("function" == b && "undefined" == typeof a.call) { | |
| 212 return"object" | |
| 213 } | |
| 214 } | |
| 215 return b | |
| 216 }; | |
| 217 goog.isDef = function(a) { | |
| 218 return void 0 !== a | |
| 219 }; | |
| 220 goog.isNull = function(a) { | |
| 221 return null === a | |
| 222 }; | |
| 223 goog.isDefAndNotNull = function(a) { | |
| 224 return null != a | |
| 225 }; | |
| 226 goog.isArray = function(a) { | |
| 227 return"array" == goog.typeOf(a) | |
| 228 }; | |
| 229 goog.isArrayLike = function(a) { | |
| 230 var b = goog.typeOf(a); | |
| 231 return"array" == b || "object" == b && "number" == typeof a.length | |
| 232 }; | |
| 233 goog.isDateLike = function(a) { | |
| 234 return goog.isObject(a) && "function" == typeof a.getFullYear | |
| 235 }; | |
| 236 goog.isString = function(a) { | |
| 237 return"string" == typeof a | |
| 238 }; | |
| 239 goog.isBoolean = function(a) { | |
| 240 return"boolean" == typeof a | |
| 241 }; | |
| 242 goog.isNumber = function(a) { | |
| 243 return"number" == typeof a | |
| 244 }; | |
| 245 goog.isFunction = function(a) { | |
| 246 return"function" == goog.typeOf(a) | |
| 247 }; | |
| 248 goog.isObject = function(a) { | |
| 249 var b = typeof a; | |
| 250 return"object" == b && null != a || "function" == b | |
| 251 }; | |
| 252 goog.getUid = function(a) { | |
| 253 return a[goog.UID_PROPERTY_] || (a[goog.UID_PROPERTY_] = ++goog.uidCounter_) | |
| 254 }; | |
| 255 goog.removeUid = function(a) { | |
| 256 "removeAttribute" in a && a.removeAttribute(goog.UID_PROPERTY_); | |
| 257 try { | |
| 258 delete a[goog.UID_PROPERTY_] | |
| 259 }catch(b) { | |
| 260 } | |
| 261 }; | |
| 262 goog.UID_PROPERTY_ = "closure_uid_" + (1E9 * Math.random() >>> 0); | |
| 263 goog.uidCounter_ = 0; | |
| 264 goog.getHashCode = goog.getUid; | |
| 265 goog.removeHashCode = goog.removeUid; | |
| 266 goog.cloneObject = function(a) { | |
| 267 var b = goog.typeOf(a); | |
| 268 if("object" == b || "array" == b) { | |
| 269 if(a.clone) { | |
| 270 return a.clone() | |
| 271 } | |
| 272 var b = "array" == b ? [] : {}, c; | |
| 273 for(c in a) { | |
| 274 b[c] = goog.cloneObject(a[c]) | |
| 275 } | |
| 276 return b | |
| 277 } | |
| 278 return a | |
| 279 }; | |
| 280 goog.bindNative_ = function(a, b, c) { | |
| 281 return a.call.apply(a.bind, arguments) | |
| 282 }; | |
| 283 goog.bindJs_ = function(a, b, c) { | |
| 284 if(!a) { | |
| 285 throw Error(); | |
| 286 } | |
| 287 if(2 < arguments.length) { | |
| 288 var d = Array.prototype.slice.call(arguments, 2); | |
| 289 return function() { | |
| 290 var c = Array.prototype.slice.call(arguments); | |
| 291 Array.prototype.unshift.apply(c, d); | |
| 292 return a.apply(b, c) | |
| 293 } | |
| 294 } | |
| 295 return function() { | |
| 296 return a.apply(b, arguments) | |
| 297 } | |
| 298 }; | |
| 299 goog.bind = function(a, b, c) { | |
| 300 Function.prototype.bind && -1 != Function.prototype.bind.toString().indexOf("n ative code") ? goog.bind = goog.bindNative_ : goog.bind = goog.bindJs_; | |
| 301 return goog.bind.apply(null, arguments) | |
| 302 }; | |
| 303 goog.partial = function(a, b) { | |
| 304 var c = Array.prototype.slice.call(arguments, 1); | |
| 305 return function() { | |
| 306 var b = Array.prototype.slice.call(arguments); | |
| 307 b.unshift.apply(b, c); | |
| 308 return a.apply(this, b) | |
| 309 } | |
| 310 }; | |
| 311 goog.mixin = function(a, b) { | |
| 312 for(var c in b) { | |
| 313 a[c] = b[c] | |
| 314 } | |
| 315 }; | |
| 316 goog.now = goog.TRUSTED_SITE && Date.now || function() { | |
| 317 return+new Date | |
| 318 }; | |
| 319 goog.globalEval = function(a) { | |
| 320 if(goog.global.execScript) { | |
| 321 goog.global.execScript(a, "JavaScript") | |
| 322 }else { | |
| 323 if(goog.global.eval) { | |
| 324 if(null == goog.evalWorksForGlobals_ && (goog.global.eval("var _et_ = 1;") , "undefined" != typeof goog.global._et_ ? (delete goog.global._et_, goog.evalWo rksForGlobals_ = !0) : goog.evalWorksForGlobals_ = !1), goog.evalWorksForGlobals _) { | |
| 325 goog.global.eval(a) | |
| 326 }else { | |
| 327 var b = goog.global.document, c = b.createElement("script"); | |
| 328 c.type = "text/javascript"; | |
| 329 c.defer = !1; | |
| 330 c.appendChild(b.createTextNode(a)); | |
| 331 b.body.appendChild(c); | |
| 332 b.body.removeChild(c) | |
| 333 } | |
| 334 }else { | |
| 335 throw Error("goog.globalEval not available"); | |
| 336 } | |
| 337 } | |
| 338 }; | |
| 339 goog.evalWorksForGlobals_ = null; | |
| 340 goog.getCssName = function(a, b) { | |
| 341 var c = function(a) { | |
| 342 return goog.cssNameMapping_[a] || a | |
| 343 }, d = function(a) { | |
| 344 a = a.split("-"); | |
| 345 for(var b = [], d = 0;d < a.length;d++) { | |
| 346 b.push(c(a[d])) | |
| 347 } | |
| 348 return b.join("-") | |
| 349 }, d = goog.cssNameMapping_ ? "BY_WHOLE" == goog.cssNameMappingStyle_ ? c : d : function(a) { | |
| 350 return a | |
| 351 }; | |
| 352 return b ? a + "-" + d(b) : d(a) | |
| 353 }; | |
| 354 goog.setCssNameMapping = function(a, b) { | |
| 355 goog.cssNameMapping_ = a; | |
| 356 goog.cssNameMappingStyle_ = b | |
| 357 }; | |
| 358 !COMPILED && goog.global.CLOSURE_CSS_NAME_MAPPING && (goog.cssNameMapping_ = goo g.global.CLOSURE_CSS_NAME_MAPPING); | |
| 359 goog.getMsg = function(a, b) { | |
| 360 var c = b || {}, d; | |
| 361 for(d in c) { | |
| 362 var e = ("" + c[d]).replace(/\$/g, "$$$$"); | |
| 363 a = a.replace(RegExp("\\{\\$" + d + "\\}", "gi"), e) | |
| 364 } | |
| 365 return a | |
| 366 }; | |
| 367 goog.getMsgWithFallback = function(a, b) { | |
| 368 return a | |
| 369 }; | |
| 370 goog.exportSymbol = function(a, b, c) { | |
| 371 goog.exportPath_(a, b, c) | |
| 372 }; | |
| 373 goog.exportProperty = function(a, b, c) { | |
| 374 a[b] = c | |
| 375 }; | |
| 376 goog.inherits = function(a, b) { | |
| 377 function c() { | |
| 378 } | |
| 379 c.prototype = b.prototype; | |
| 380 a.superClass_ = b.prototype; | |
| 381 a.prototype = new c; | |
| 382 a.prototype.constructor = a | |
| 383 }; | |
| 384 goog.base = function(a, b, c) { | |
| 385 var d = arguments.callee.caller; | |
| 386 if(goog.DEBUG && !d) { | |
| 387 throw Error("arguments.caller not defined. goog.base() expects not to be ru nning in strict mode. See http://www.ecma-international.org/ecma-262/5.1/#sec-C" ); | |
| 388 } | |
| 389 if(d.superClass_) { | |
| 390 return d.superClass_.constructor.apply(a, Array.prototype.slice.call(argumen ts, 1)) | |
| 391 } | |
| 392 for(var e = Array.prototype.slice.call(arguments, 2), f = !1, g = a.constructo r;g;g = g.superClass_ && g.superClass_.constructor) { | |
| 393 if(g.prototype[b] === d) { | |
| 394 f = !0 | |
| 395 }else { | |
| 396 if(f) { | |
| 397 return g.prototype[b].apply(a, e) | |
| 398 } | |
| 399 } | |
| 400 } | |
| 401 if(a[b] === d) { | |
| 402 return a.constructor.prototype[b].apply(a, e) | |
| 403 } | |
| 404 throw Error("goog.base called from a method of one name to a method of a diffe rent name"); | |
| 405 }; | |
| 406 goog.scope = function(a) { | |
| 407 a.call(goog.global) | |
| 408 }; | |
| 409 var axs = {}; | |
| 410 axs.browserUtils = {}; | |
| 411 axs.browserUtils.matchSelector = function(a, b) { | |
| 412 return a.webkitMatchesSelector ? a.webkitMatchesSelector(b) : a.mozMatchesSele ctor ? a.mozMatchesSelector(b) : !1 | |
| 413 }; | |
| 414 axs.constants = {}; | |
| 415 axs.constants.ARIA_ROLES = {alert:{namefrom:["author"], parent:["region"]}, aler tdialog:{namefrom:["author"], namerequired:!0, parent:["alert", "dialog"]}, appl ication:{namefrom:["author"], namerequired:!0, parent:["landmark"]}, article:{na mefrom:["author"], parent:["document", "region"]}, banner:{namefrom:["author"], parent:["landmark"]}, button:{childpresentational:!0, namefrom:["contents", "aut hor"], namerequired:!0, parent:["command"], properties:["aria-expanded", "aria-p ressed"]}, checkbox:{namefrom:["contents", | |
| 416 "author"], namerequired:!0, parent:["input"], requiredProperties:["aria-checked" ], properties:["aria-checked"]}, columnheader:{namefrom:["contents", "author"], namerequired:!0, parent:["gridcell", "sectionhead", "widget"], properties:["aria -sort"]}, combobox:{mustcontain:["listbox", "textbox"], namefrom:["author"], nam erequired:!0, parent:["select"], requiredProperties:["aria-expanded"], propertie s:["aria-expanded", "aria-autocomplete", "aria-required"]}, command:{"abstract": !0, namefrom:["author"], | |
| 417 parent:["widget"]}, complementary:{namefrom:["author"], parent:["landmark"]}, co mposite:{"abstract":!0, childpresentational:!1, namefrom:["author"], parent:["wi dget"], properties:["aria-activedescendant"]}, contentinfo:{namefrom:["author"], parent:["landmark"]}, definition:{namefrom:["author"], parent:["section"]}, dia log:{namefrom:["author"], namerequired:!0, parent:["window"]}, directory:{namefr om:["contents", "author"], parent:["list"]}, document:{namefrom:[" author"], nam erequired:!0, parent:["structure"], | |
| 418 properties:["aria-expanded"]}, form:{namefrom:["author"], parent:["landmark"]}, grid:{mustcontain:["row", "rowgroup"], namefrom:["author"], namerequired:!0, par ent:["composite", "region"], properties:["aria-level", "aria-multiselectable", " aria-readonly"]}, gridcell:{namefrom:["contents", "author"], namerequired:!0, pa rent:["section", "widget"], properties:["aria-readonly", "aria-required", "aria- selected"]}, group:{namefrom:[" author"], parent:["section"], properties:["aria- activedescendant"]}, | |
| 419 heading:{namerequired:!0, parent:["sectionhead"], properties:["aria-level"]}, im g:{childpresentational:!0, namefrom:["author"], namerequired:!0, parent:["sectio n"]}, input:{"abstract":!0, namefrom:["author"], parent:["widget"]}, landmark:{" abstract":!0, namefrom:["contents", "author"], namerequired:!1, parent:["region" ]}, link:{namefrom:["contents", "author"], namerequired:!0, parent:["command"], properties:["aria-expanded"]}, list:{mustcontain:["group", "listitem"], namefrom :["author"], parent:["region"]}, | |
| 420 listbox:{mustcontain:["option"], namefrom:["author"], namerequired:!0, parent:[" list", "select"], properties:["aria-multiselectable", "aria-required"]}, listite m:{namefrom:["contents", "author"], namerequired:!0, parent:["section"], propert ies:["aria-level", "aria-posinset", "aria-setsize"]}, log:{namefrom:[" author"], namerequired:!0, parent:["region"]}, main:{namefrom:["author"], parent:["landma rk"]}, marquee:{namerequired:!0, parent:["section"]}, math:{childpresentational: !0, namefrom:["author"], | |
| 421 parent:["section"]}, menu:{mustcontain:["group", "menuitemradio", "menuitem", "m enuitemcheckbox"], namefrom:["author"], namerequired:!0, parent:["list", "select "]}, menubar:{namefrom:["author"], parent:["menu"]}, menuitem:{namefrom:["conten ts", "author"], namerequired:!0, parent:["command"]}, menuitemcheckbox:{namefrom :["contents", "author"], namerequired:!0, parent:["checkbox", "menuitem"]}, menu itemradio:{namefrom:["contents", "author"], namerequired:!0, parent:["menuitemch eckbox", "radio"]}, navigation:{namefrom:["author"], | |
| 422 parent:["landmark"]}, note:{namefrom:["author"], parent:["section"]}, option:{na mefrom:["contents", "author"], namerequired:!0, parent:["input"], properties:["a ria-checked", "aria-posinset", "aria-selected", "aria-setsize"]}, presentation:{ parent:["structure"]}, progressbar:{childpresentational:!0, namefrom:["author"], namerequired:!0, parent:["range"]}, radio:{namefrom:["contents", "author"], nam erequired:!0, parent:["checkbox", "option"]}, radiogroup:{mustcontain:["radio"], namefrom:["author"], | |
| 423 namerequired:!0, parent:["select"], properties:["aria-required"]}, range:{"abstr act":!0, namefrom:["author"], parent:["widget"], properties:["aria-valuemax", "a ria-valuemin", "aria-valuenow", "aria-valuetext"]}, region:{namefrom:[" author"] , parent:["section"]}, roletype:{"abstract":!0, properties:"aria-atomic aria-bus y aria-controls aria-describedby aria-disabled aria-dropeffect aria-flowto aria- grabbed aria-haspopup aria-hidden aria-invalid aria-label aria-labelledby aria-l ive aria-owns aria-relevant".split(" ")}, | |
| 424 row:{mustcontain:["columnheader", "gridcell", "rowheader"], namefrom:["contents" , "author"], parent:["group", "widget"], properties:["aria-level", "aria-selecte d"]}, rowgroup:{mustcontain:["row"], namefrom:["contents", "author"], parent:["g roup"]}, rowheader:{namefrom:["contents", "author"], namerequired:!0, parent:["g ridcell", "sectionhead", "widget"], properties:["aria-sort"]}, search:{namefrom: ["author"], parent:["landmark"]}, section:{"abstract":!0, namefrom:["contents", "author"], parent:["structure"], | |
| 425 properties:["aria-expanded"]}, sectionhead:{"abstract":!0, namefrom:["contents", "author"], parent:["structure"], properties:["aria-expanded"]}, select:{"abstra ct":!0, namefrom:["author"], parent:["composite", "group", "input"]}, separator: {childpresentational:!0, namefrom:["author"], parent:["structure"], properties:[ "aria-expanded", "aria-orientation"]}, scrollbar:{childpresentational:!0, namefr om:["author"], namerequired:!1, parent:["input", "range"], requiredProperties:[" aria-controls", "aria-orientation", | |
| 426 "aria-valuemax", "aria-valuemin", "aria-valuenow"], properties:["aria-controls", "aria-orientation", "aria-valuemax", "aria-valuemin", "aria-valuenow"]}, slider :{childpresentational:!0, namefrom:["author"], namerequired:!0, parent:["input", "range"], requiredProperties:["aria-valuemax", "aria-valuemin", "aria-valuenow" ], properties:["aria-valuemax", "aria-valuemin", "aria-valuenow", "aria-orientat ion"]}, spinbutton:{namefrom:["author"], namerequired:!0, parent:["input", "rang e"], requiredProperties:["aria-valuemax", | |
| 427 "aria-valuemin", "aria-valuenow"], properties:["aria-valuemax", "aria-valuemin", "aria-valuenow", "aria-required"]}, status:{parent:["region"]}, structure:{"abs tract":!0, parent:["roletype"]}, tab:{namefrom:["contents", "author"], parent:[" sectionhead", "widget"], properties:["aria-selected"]}, tablist:{mustcontain:["t ab"], namefrom:["author"], parent:["composite", "directory"], properties:["aria- level"]}, tabpanel:{namefrom:["author"], namerequired:!0, parent:["region"]}, te xtbox:{namefrom:["author"], | |
| 428 namerequired:!0, parent:["input"], properties:["aria-activedescendant", "aria-au tocomplete", "aria-multiline", "aria-readonly", "aria-required"]}, timer:{namefr om:["author"], namerequired:!0, parent:["status"]}, toolbar:{namefrom:["author"] , parent:["group"]}, tooltip:{namerequired:!0, parent:["section"]}, tree:{mustco ntain:["group", "treeitem"], namefrom:["author"], namerequired:!0, parent:["sele ct"], properties:["aria-multiselectable", "aria-required"]}, treegrid:{mustconta in:["row"], namefrom:["author"], | |
| 429 namerequired:!0, parent:["grid", "tree"]}, treeitem:{namefrom:["contents", "auth or"], namerequired:!0, parent:["listitem", "option"]}, widget:{"abstract":!0, pa rent:["roletype"]}, window:{"abstract":!0, namefrom:[" author"], parent:["rolety pe"], properties:["aria-expanded"]}}; | |
| 430 axs.constants.WIDGET_ROLES = {}; | |
| 431 axs.constants.addAllParentRolesToSet_ = function(a, b) { | |
| 432 if(a.parent) { | |
| 433 for(var c = a.parent, d = 0;d < c.length;d++) { | |
| 434 var e = c[d]; | |
| 435 b[e] = !0; | |
| 436 axs.constants.addAllParentRolesToSet_(axs.constants.ARIA_ROLES[e], b) | |
| 437 } | |
| 438 } | |
| 439 }; | |
| 440 axs.constants.addAllPropertiesToSet_ = function(a, b, c) { | |
| 441 var d = a[b]; | |
| 442 if(d) { | |
| 443 for(var e = 0;e < d.length;e++) { | |
| 444 c[d[e]] = !0 | |
| 445 } | |
| 446 } | |
| 447 if(a.parent) { | |
| 448 for(a = a.parent, d = 0;d < a.length;d++) { | |
| 449 axs.constants.addAllPropertiesToSet_(axs.constants.ARIA_ROLES[a[d]], b, c) | |
| 450 } | |
| 451 } | |
| 452 }; | |
| 453 for(var roleName in axs.constants.ARIA_ROLES) { | |
| 454 var role = axs.constants.ARIA_ROLES[roleName], propertiesSet = {}; | |
| 455 axs.constants.addAllPropertiesToSet_(role, "properties", propertiesSet); | |
| 456 role.propertiesSet = propertiesSet; | |
| 457 var requiredPropertiesSet = {}; | |
| 458 axs.constants.addAllPropertiesToSet_(role, "requiredProperties", requiredPrope rtiesSet); | |
| 459 role.requiredPropertiesSet = requiredPropertiesSet; | |
| 460 var parentRolesSet = {}; | |
| 461 axs.constants.addAllParentRolesToSet_(role, parentRolesSet); | |
| 462 role.allParentRolesSet = parentRolesSet; | |
| 463 "widget" in parentRolesSet && (axs.constants.WIDGET_ROLES[roleName] = role) | |
| 464 } | |
| 465 axs.constants.ARIA_PROPERTIES = {activedescendant:{type:"property", valueType:"i dref"}, atomic:{defaultValue:"false", type:"property", valueType:"boolean"}, aut ocomplete:{defaultValue:"none", type:"property", valueType:"token", values:["inl ine", "list", "both", "none"]}, busy:{defaultValue:"false", type:"state", valueT ype:"boolean"}, checked:{defaultValue:"undefined", type:"state", valueType:"toke n", values:["true", "false", "mixed", "undefined"]}, controls:{type:"property", valueType:"idref_list"}, | |
| 466 describedby:{type:"property", valueType:"idref_list"}, disabled:{defaultValue:"f alse", type:"state", valueType:"boolean"}, dropeffect:{defaultValue:"none", type :"property", valueType:"token_list", values:"copy move link execute popup none". split(" ")}, expanded:{defaultValue:"undefined", type:"state", valueType:"token" , values:["true", "false", "undefined"]}, flowto:{type:"property", valueType:"id ref_list"}, grabbed:{defaultValue:"undefined", type:"state", valueType:"token", values:["true", "false", | |
| 467 "undefined"]}, haspopup:{defaultValue:"false", type:"property", valueType:"boole an"}, hidden:{defaultValue:"false", type:"state", valueType:"boolean"}, invalid: {defaultValue:"false", type:"state", valueType:"token", values:["grammar", "fals e", "spelling", "true"]}, label:{type:"property", valueType:"string"}, labelledb y:{type:"property", valueType:"idref_list"}, level:{type:"property", valueType:" integer"}, live:{defaultValue:"off", type:"property", valueType:"token", values: ["off", "polite", "assertive"]}, | |
| 468 multiline:{defaultValue:"false", type:"property", valueType:"boolean"}, multisel ectable:{defaultValue:"false", type:"property", valueType:"boolean"}, orientatio n:{defaultValue:"vertical", type:"property", valueType:"token", values:["horizon tal", "vertical"]}, owns:{type:"property", valueType:"idref_list"}, posinset:{ty pe:"property", valueType:"integer"}, pressed:{defaultValue:"undefined", type:"st ate", valueType:"token", values:["true", "false", "mixed", "undefined"]}, readon ly:{defaultValue:"false", | |
| 469 type:"property", valueType:"boolean"}, relevant:{defaultValue:"additions text", type:"property", valueType:"token_list", values:["additions", "removals", "text" , "all"]}, required:{defaultValue:"false", type:"property", valueType:"boolean"} , selected:{defaultValue:"undefined", type:"state", valueType:"token", values:[" true", "false", "undefined"]}, setsize:{type:"property", valueType:"integer"}, s ort:{defaultValue:"none", type:"property", valueType:"token", values:["ascending ", "descending", "none", | |
| 470 "other"]}, valuemax:{type:"property", valueType:"decimal"}, valuemin:{type:"prop erty", valueType:"decimal"}, valuenow:{type:"property", valueType:"decimal"}, va luetext:{type:"property", valueType:"string"}}; | |
| 471 axs.constants.GLOBAL_PROPERTIES = "aria-atomic aria-busy aria-controls aria-desc ribedby aria-disabled aria-dropeffect aria-flowto aria-grabbed aria-haspopup ari a-hidden aria-invalid aria-label aria-labelledby aria-live aria-owns aria-releva nt".split(" "); | |
| 472 axs.constants.NO_ROLE_NAME = " "; | |
| 473 axs.constants.WIDGET_ROLE_TO_NAME = {alert:"aria_role_alert", alertdialog:"aria_ role_alertdialog", button:"aria_role_button", checkbox:"aria_role_checkbox", col umnheader:"aria_role_columnheader", combobox:"aria_role_combobox", dialog:"aria_ role_dialog", grid:"aria_role_grid", gridcell:"aria_role_gridcell", link:"aria_r ole_link", listbox:"aria_role_listbox", log:"aria_role_log", marquee:"aria_role_ marquee", menu:"aria_role_menu", menubar:"aria_role_menubar", menuitem:"aria_rol e_menuitem", menuitemcheckbox:"aria_role_menuitemcheckbox", | |
| 474 menuitemradio:"aria_role_menuitemradio", option:axs.constants.NO_ROLE_NAME, prog ressbar:"aria_role_progressbar", radio:"aria_role_radio", radiogroup:"aria_role_ radiogroup", rowheader:"aria_role_rowheader", scrollbar:"aria_role_scrollbar", s lider:"aria_role_slider", spinbutton:"aria_role_spinbutton", status:"aria_role_s tatus", tab:"aria_role_tab", tabpanel:"aria_role_tabpanel", textbox:"aria_role_t extbox", timer:"aria_role_timer", toolbar:"aria_role_toolbar", tooltip:"aria_rol e_tooltip", treeitem:"aria_role_treeitem"}; | |
| 475 axs.constants.STRUCTURE_ROLE_TO_NAME = {article:"aria_role_article", application :"aria_role_application", banner:"aria_role_banner", columnheader:"aria_role_col umnheader", complementary:"aria_role_complementary", contentinfo:"aria_role_cont entinfo", definition:"aria_role_definition", directory:"aria_role_directory", do cument:"aria_role_document", form:"aria_role_form", group:"aria_role_group", hea ding:"aria_role_heading", img:"aria_role_img", list:"aria_role_list", listitem:" aria_role_listitem", | |
| 476 main:"aria_role_main", math:"aria_role_math", navigation:"aria_role_navigation", note:"aria_role_note", region:"aria_role_region", rowheader:"aria_role_rowheade r", search:"aria_role_search", separator:"aria_role_separator"}; | |
| 477 axs.constants.ATTRIBUTE_VALUE_TO_STATUS = [{name:"aria-autocomplete", values:{in line:"aria_autocomplete_inline", list:"aria_autocomplete_list", both:"aria_autoc omplete_both"}}, {name:"aria-checked", values:{"true":"aria_checked_true", "fals e":"aria_checked_false", mixed:"aria_checked_mixed"}}, {name:"aria-disabled", va lues:{"true":"aria_disabled_true"}}, {name:"aria-expanded", values:{"true":"aria _expanded_true", "false":"aria_expanded_false"}}, {name:"aria-invalid", values:{ "true":"aria_invalid_true", | |
| 478 grammar:"aria_invalid_grammar", spelling:"aria_invalid_spelling"}}, {name:"aria- multiline", values:{"true":"aria_multiline_true"}}, {name:"aria-multiselectable" , values:{"true":"aria_multiselectable_true"}}, {name:"aria-pressed", values:{"t rue":"aria_pressed_true", "false":"aria_pressed_false", mixed:"aria_pressed_mixe d"}}, {name:"aria-readonly", values:{"true":"aria_readonly_true"}}, {name:"aria- required", values:{"true":"aria_required_true"}}, {name:"aria-selected", values: {"true":"aria_selected_true", | |
| 479 "false":"aria_selected_false"}}]; | |
| 480 axs.constants.INPUT_TYPE_TO_INFORMATION_TABLE_MSG = {button:"input_type_button", checkbox:"input_type_checkbox", color:"input_type_color", datetime:"input_type_ datetime", "datetime-local":"input_type_datetime_local", date:"input_type_date", email:"input_type_email", file:"input_type_file", image:"input_type_image", mon th:"input_type_month", number:"input_type_number", password:"input_type_password ", radio:"input_type_radio", range:"input_type_range", reset:"input_type_reset", search:"input_type_search", | |
| 481 submit:"input_type_submit", tel:"input_type_tel", text:"input_type_text", url:"i nput_type_url", week:"input_type_week"}; | |
| 482 axs.constants.TAG_TO_INFORMATION_TABLE_VERBOSE_MSG = {A:"tag_link", BUTTON:"tag_ button", H1:"tag_h1", H2:"tag_h2", H3:"tag_h3", H4:"tag_h4", H5:"tag_h5", H6:"ta g_h6", LI:"tag_li", OL:"tag_ol", SELECT:"tag_select", TEXTAREA:"tag_textarea", U L:"tag_ul", SECTION:"tag_section", NAV:"tag_nav", ARTICLE:"tag_article", ASIDE:" tag_aside", HGROUP:"tag_hgroup", HEADER:"tag_header", FOOTER:"tag_footer", TIME: "tag_time", MARK:"tag_mark"}; | |
| 483 axs.constants.TAG_TO_INFORMATION_TABLE_BRIEF_MSG = {BUTTON:"tag_button", SELECT: "tag_select", TEXTAREA:"tag_textarea"}; | |
| 484 axs.constants.MIXED_VALUES = {"true":!0, "false":!0, mixed:!0}; | |
| 485 (function() { | |
| 486 for(var a in axs.constants.ARIA_PROPERTIES) { | |
| 487 var b = axs.constants.ARIA_PROPERTIES[a]; | |
| 488 if(b.values) { | |
| 489 for(var c = {}, d = 0;d < b.values.length;d++) { | |
| 490 c[b.values[d]] = !0 | |
| 491 } | |
| 492 b.valuesSet = c | |
| 493 } | |
| 494 } | |
| 495 })(); | |
| 496 axs.constants.Severity = {INFO:"Info", WARNING:"Warning", SEVERE:"Severe"}; | |
| 497 axs.constants.AuditResult = {PASS:"PASS", FAIL:"FAIL", NA:"NA"}; | |
| 498 axs.constants.InlineElements = {TT:!0, I:!0, B:!0, BIG:!0, SMALL:!0, EM:!0, STRO NG:!0, DFN:!0, CODE:!0, SAMP:!0, KBD:!0, VAR:!0, CITE:!0, ABBR:!0, ACRONYM:!0, A :!0, IMG:!0, OBJECT:!0, BR:!0, SCRIPT:!0, MAP:!0, Q:!0, SUB:!0, SUP:!0, SPAN:!0, BDO:!0, INPUT:!0, SELECT:!0, TEXTAREA:!0, LABEL:!0, BUTTON:!0}; | |
| 499 axs.utils = {}; | |
| 500 axs.utils.FOCUSABLE_ELEMENTS_SELECTOR = "input:not([type=hidden]):not([disabled] ),select:not([disabled]),textarea:not([disabled]),button:not([disabled]),a[href] ,iframe,[tabindex]"; | |
| 501 axs.utils.Color = function(a, b, c, d) { | |
| 502 this.red = a; | |
| 503 this.green = b; | |
| 504 this.blue = c; | |
| 505 this.alpha = d | |
| 506 }; | |
| 507 axs.utils.calculateContrastRatio = function(a, b) { | |
| 508 if(!a || !b) { | |
| 509 return null | |
| 510 } | |
| 511 1 > a.alpha && (a = axs.utils.flattenColors(a, b)); | |
| 512 var c = axs.utils.calculateLuminance(a), d = axs.utils.calculateLuminance(b); | |
| 513 return(Math.max(c, d) + 0.05) / (Math.min(c, d) + 0.05) | |
| 514 }; | |
| 515 axs.utils.luminanceRatio = function(a, b) { | |
| 516 return(Math.max(a, b) + 0.05) / (Math.min(a, b) + 0.05) | |
| 517 }; | |
| 518 axs.utils.asElement = function(a) { | |
| 519 switch(a.nodeType) { | |
| 520 case Node.COMMENT_NODE: | |
| 521 return null; | |
| 522 case Node.ELEMENT_NODE: | |
| 523 if("script" == a.tagName.toLowerCase()) { | |
| 524 return null | |
| 525 } | |
| 526 break; | |
| 527 case Node.TEXT_NODE: | |
| 528 a = a.parentElement; | |
| 529 break; | |
| 530 default: | |
| 531 return console.warn("Unhandled node type: ", a.nodeType), null | |
| 532 } | |
| 533 return a | |
| 534 }; | |
| 535 axs.utils.elementIsTransparent = function(a) { | |
| 536 return"0" == a.style.opacity | |
| 537 }; | |
| 538 axs.utils.elementHasZeroArea = function(a) { | |
| 539 a = a.getBoundingClientRect(); | |
| 540 var b = a.top - a.bottom; | |
| 541 return a.right - a.left && b ? !1 : !0 | |
| 542 }; | |
| 543 axs.utils.elementIsOutsideScrollArea = function(a) { | |
| 544 a = a.getBoundingClientRect(); | |
| 545 var b = document.body.scrollWidth, c = document.body.scrollTop, d = document.b ody.scrollLeft; | |
| 546 return a.top >= document.body.scrollHeight || a.bottom <= -c || a.left >= b || a.right <= -d ? !0 : !1 | |
| 547 }; | |
| 548 axs.utils.isAncestor = function(a, b) { | |
| 549 return null == b ? !1 : b === a ? !0 : axs.utils.isAncestor(a, b.parentNode) | |
| 550 }; | |
| 551 axs.utils.overlappingElement = function(a) { | |
| 552 if(axs.utils.elementHasZeroArea(a)) { | |
| 553 return null | |
| 554 } | |
| 555 var b = a.getBoundingClientRect(), b = document.elementFromPoint((b.left + b.r ight) / 2, (b.top + b.bottom) / 2); | |
| 556 return null == b || b == a || axs.utils.isAncestor(b, a) || axs.utils.isAncest or(a, b) ? null : b | |
| 557 }; | |
| 558 axs.utils.elementIsHtmlControl = function(a) { | |
| 559 var b = a.ownerDocument.defaultView; | |
| 560 return a instanceof b.HTMLButtonElement || a instanceof b.HTMLInputElement || a instanceof b.HTMLSelectElement || a instanceof b.HTMLTextAreaElement ? !0 : !1 | |
| 561 }; | |
| 562 axs.utils.elementIsAriaWidget = function(a) { | |
| 563 return a.hasAttribute("role") && (a = a.getAttribute("role")) && (a = axs.cons tants.ARIA_ROLES[a]) && "widget" in a.allParentRolesSet ? !0 : !1 | |
| 564 }; | |
| 565 axs.utils.elementIsVisible = function(a) { | |
| 566 if(axs.utils.elementIsTransparent(a) || axs.utils.elementHasZeroArea(a) || axs .utils.elementIsOutsideScrollArea(a)) { | |
| 567 return!1 | |
| 568 } | |
| 569 if(a = axs.utils.overlappingElement(a)) { | |
| 570 var b = window.getComputedStyle(a, null); | |
| 571 if(b && (a = axs.utils.getBgColor(b, a)) && 0 < a.alpha) { | |
| 572 return!1 | |
| 573 } | |
| 574 } | |
| 575 return!0 | |
| 576 }; | |
| 577 axs.utils.isLargeFont = function(a) { | |
| 578 var b = a.fontSize; | |
| 579 a = "bold" == a.fontWeight; | |
| 580 var c = b.match(/(\d+)px/); | |
| 581 if(c) { | |
| 582 b = parseInt(c[1], 10); | |
| 583 if(c = window.getComputedStyle(document.body, null).fontSize.match(/(\d+)px/ )) { | |
| 584 var d = parseInt(c[1], 10), c = 1.2 * d, d = 1.5 * d | |
| 585 }else { | |
| 586 c = 19.2, d = 24 | |
| 587 } | |
| 588 return a && b >= c || b >= d | |
| 589 } | |
| 590 if(c = b.match(/(\d+)em/)) { | |
| 591 return b = parseInt(c[1], 10), a && 1.2 <= b || 1.5 <= b ? !0 : !1 | |
| 592 } | |
| 593 if(c = b.match(/(\d+)%/)) { | |
| 594 return b = parseInt(c[1], 10), a && 120 <= b || 150 <= b ? !0 : !1 | |
| 595 } | |
| 596 if(c = b.match(/(\d+)pt/)) { | |
| 597 if(b = parseInt(c[1], 10), a && 14 <= b || 14 <= b) { | |
| 598 return!0 | |
| 599 } | |
| 600 } | |
| 601 return!1 | |
| 602 }; | |
| 603 axs.utils.getBgColor = function(a, b) { | |
| 604 var c = axs.utils.parseColor(a.backgroundColor); | |
| 605 if(!c) { | |
| 606 return null | |
| 607 } | |
| 608 1 > a.opacity && (c.alpha *= a.opacity); | |
| 609 if(1 > c.alpha) { | |
| 610 var d = axs.utils.getParentBgColor(b); | |
| 611 if(null == d) { | |
| 612 return null | |
| 613 } | |
| 614 c = axs.utils.flattenColors(c, d) | |
| 615 } | |
| 616 return c | |
| 617 }; | |
| 618 axs.utils.getParentBgColor = function(a) { | |
| 619 var b = a; | |
| 620 a = []; | |
| 621 for(var c = null;b = b.parentElement;) { | |
| 622 var d = window.getComputedStyle(b, null); | |
| 623 if(d) { | |
| 624 var e = axs.utils.parseColor(d.backgroundColor); | |
| 625 if(e && (1 > d.opacity && (e.alpha *= d.opacity), 0 != e.alpha && (a.push( e), 1 == e.alpha))) { | |
| 626 c = !0; | |
| 627 break | |
| 628 } | |
| 629 } | |
| 630 } | |
| 631 c || a.push(new axs.utils.Color(255, 255, 255, 1)); | |
| 632 for(b = a.pop();a.length;) { | |
| 633 c = a.pop(), b = axs.utils.flattenColors(c, b) | |
| 634 } | |
| 635 return b | |
| 636 }; | |
| 637 axs.utils.getFgColor = function(a, b, c) { | |
| 638 var d = axs.utils.parseColor(a.color); | |
| 639 if(!d) { | |
| 640 return null | |
| 641 } | |
| 642 1 > d.alpha && (d = axs.utils.flattenColors(d, c)); | |
| 643 1 > a.opacity && (b = axs.utils.getParentBgColor(b), d.alpha *= a.opacity, d = axs.utils.flattenColors(d, b)); | |
| 644 return d | |
| 645 }; | |
| 646 axs.utils.parseColor = function(a) { | |
| 647 var b = a.match(/^rgb\((\d+), (\d+), (\d+)\)$/); | |
| 648 if(b) { | |
| 649 a = parseInt(b[1], 10); | |
| 650 var c = parseInt(b[2], 10), b = parseInt(b[3], 10), d; | |
| 651 return new axs.utils.Color(a, c, b, 1) | |
| 652 } | |
| 653 return(b = a.match(/^rgba\((\d+), (\d+), (\d+), (\d+(\.\d+)?)\)/)) ? (d = pars eInt(b[4], 10), a = parseInt(b[1], 10), c = parseInt(b[2], 10), b = parseInt(b[3 ], 10), new axs.utils.Color(a, c, b, d)) : null | |
| 654 }; | |
| 655 axs.utils.colorChannelToString = function(a) { | |
| 656 a = Math.round(a); | |
| 657 return 15 >= a ? "0" + a.toString(16) : a.toString(16) | |
| 658 }; | |
| 659 axs.utils.colorToString = function(a) { | |
| 660 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() + ")" | |
| 661 }; | |
| 662 axs.utils.luminanceFromContrastRatio = function(a, b, c) { | |
| 663 return c ? (a + 0.05) * b - 0.05 : (a + 0.05) / b - 0.05 | |
| 664 }; | |
| 665 axs.utils.translateColor = function(a, b) { | |
| 666 var c = a[0], c = (b - c) / ((c > b ? 0 : 1) - c); | |
| 667 return axs.utils.fromYCC([b, a[1] - a[1] * c, a[2] - a[2] * c]) | |
| 668 }; | |
| 669 axs.utils.suggestColors = function(a, b, c, d) { | |
| 670 if(!axs.utils.isLowContrast(c, d, !0)) { | |
| 671 return null | |
| 672 } | |
| 673 var e = {}, f = axs.utils.calculateLuminance(a), g = axs.utils.calculateLumina nce(b), h = axs.utils.isLargeFont(d) ? 3 : 4.5, k = axs.utils.isLargeFont(d) ? 4 .5 : 7, m = g > f, l = axs.utils.luminanceFromContrastRatio(f, h + 0.02, m), n = axs.utils.luminanceFromContrastRatio(f, k + 0.02, m), q = axs.utils.toYCC(b); | |
| 674 if(axs.utils.isLowContrast(c, d, !1) && 1 >= l && 0 <= l) { | |
| 675 var p = axs.utils.translateColor(q, l), l = axs.utils.calculateContrastRatio (p, a); | |
| 676 axs.utils.calculateLuminance(p); | |
| 677 f = {}; | |
| 678 f.fg = axs.utils.colorToString(p); | |
| 679 f.bg = axs.utils.colorToString(a); | |
| 680 f.contrast = l.toFixed(2); | |
| 681 e.AA = f | |
| 682 } | |
| 683 axs.utils.isLowContrast(c, d, !0) && 1 >= n && 0 <= n && (n = axs.utils.transl ateColor(q, n), l = axs.utils.calculateContrastRatio(n, a), f = {}, f.fg = axs.u tils.colorToString(n), f.bg = axs.utils.colorToString(a), f.contrast = l.toFixed (2), e.AAA = f); | |
| 684 h = axs.utils.luminanceFromContrastRatio(g, h + 0.02, !m); | |
| 685 g = axs.utils.luminanceFromContrastRatio(g, k + 0.02, !m); | |
| 686 a = axs.utils.toYCC(a); | |
| 687 !("AA" in e) && axs.utils.isLowContrast(c, d, !1) && 1 >= h && 0 <= h && (k = axs.utils.translateColor(a, h), l = axs.utils.calculateContrastRatio(b, k), f = {}, f.bg = axs.utils.colorToString(k), f.fg = axs.utils.colorToString(b), f.cont rast = l.toFixed(2), e.AA = f); | |
| 688 !("AAA" in e) && axs.utils.isLowContrast(c, d, !0) && 1 >= g && 0 <= g && (c = axs.utils.translateColor(a, g), l = axs.utils.calculateContrastRatio(b, c), f = {}, f.bg = axs.utils.colorToString(c), f.fg = axs.utils.colorToString(b), f.con trast = l.toFixed(2), e.AAA = f); | |
| 689 return e | |
| 690 }; | |
| 691 axs.utils.flattenColors = function(a, b) { | |
| 692 var c = a.alpha; | |
| 693 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)) | |
| 694 }; | |
| 695 axs.utils.calculateLuminance = function(a) { | |
| 696 return axs.utils.toYCC(a)[0] | |
| 697 }; | |
| 698 axs.utils.RGBToYCCMatrix = function(a, b) { | |
| 699 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)]] | |
| 700 }; | |
| 701 axs.utils.invert3x3Matrix = function(a) { | |
| 702 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]; | |
| 703 a = a[2][2]; | |
| 704 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))) | |
| 705 }; | |
| 706 axs.utils.scalarMultiplyMatrix = function(a, b) { | |
| 707 for(var c = [[], [], []], d = 0;3 > d;d++) { | |
| 708 for(var e = 0;3 > e;e++) { | |
| 709 c[d][e] = a[d][e] * b | |
| 710 } | |
| 711 } | |
| 712 return c | |
| 713 }; | |
| 714 axs.utils.kR = 0.2126; | |
| 715 axs.utils.kB = 0.0722; | |
| 716 axs.utils.YCC_MATRIX = axs.utils.RGBToYCCMatrix(axs.utils.kR, axs.utils.kB); | |
| 717 axs.utils.INVERTED_YCC_MATRIX = axs.utils.invert3x3Matrix(axs.utils.YCC_MATRIX); | |
| 718 axs.utils.convertColor = function(a, b) { | |
| 719 var c = b[0], d = b[1], e = b[2]; | |
| 720 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] | |
| 721 }; | |
| 722 axs.utils.multiplyMatrices = function(a, b) { | |
| 723 for(var c = [[], [], []], d = 0;3 > d;d++) { | |
| 724 for(var e = 0;3 > e;e++) { | |
| 725 c[d][e] = a[d][0] * b[0][e] + a[d][1] * b[1][e] + a[d][2] * b[2][e] | |
| 726 } | |
| 727 } | |
| 728 return c | |
| 729 }; | |
| 730 axs.utils.toYCC = function(a) { | |
| 731 var b = a.red / 255, c = a.green / 255; | |
| 732 a = a.blue / 255; | |
| 733 b = 0.03928 >= b ? b / 12.92 : Math.pow((b + 0.055) / 1.055, 2.4); | |
| 734 c = 0.03928 >= c ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4); | |
| 735 a = 0.03928 >= a ? a / 12.92 : Math.pow((a + 0.055) / 1.055, 2.4); | |
| 736 return axs.utils.convertColor(axs.utils.YCC_MATRIX, [b, c, a]) | |
| 737 }; | |
| 738 axs.utils.fromYCC = function(a) { | |
| 739 var b = axs.utils.convertColor(axs.utils.INVERTED_YCC_MATRIX, a), c = b[0]; | |
| 740 a = b[1]; | |
| 741 b = b[2]; | |
| 742 c = 0.00303949 >= c ? 12.92 * c : 1.055 * Math.pow(c, 1 / 2.4) - 0.055; | |
| 743 a = 0.00303949 >= a ? 12.92 * a : 1.055 * Math.pow(a, 1 / 2.4) - 0.055; | |
| 744 b = 0.00303949 >= b ? 12.92 * b : 1.055 * Math.pow(b, 1 / 2.4) - 0.055; | |
| 745 c = Math.min(Math.max(Math.round(255 * c), 0), 255); | |
| 746 a = Math.min(Math.max(Math.round(255 * a), 0), 255); | |
| 747 b = Math.min(Math.max(Math.round(255 * b), 0), 255); | |
| 748 return new axs.utils.Color(c, a, b, 1) | |
| 749 }; | |
| 750 axs.utils.scalarMultiplyMatrix = function(a, b) { | |
| 751 for(var c = [[], [], []], d = 0;3 > d;d++) { | |
| 752 for(var e = 0;3 > e;e++) { | |
| 753 c[d][e] = a[d][e] * b | |
| 754 } | |
| 755 } | |
| 756 return c | |
| 757 }; | |
| 758 axs.utils.multiplyMatrices = function(a, b) { | |
| 759 for(var c = [[], [], []], d = 0;3 > d;d++) { | |
| 760 for(var e = 0;3 > e;e++) { | |
| 761 c[d][e] = a[d][0] * b[0][e] + a[d][1] * b[1][e] + a[d][2] * b[2][e] | |
| 762 } | |
| 763 } | |
| 764 return c | |
| 765 }; | |
| 766 axs.utils.getContrastRatioForElement = function(a) { | |
| 767 var b = window.getComputedStyle(a, null); | |
| 768 return axs.utils.getContrastRatioForElementWithComputedStyle(b, a) | |
| 769 }; | |
| 770 axs.utils.getContrastRatioForElementWithComputedStyle = function(a, b) { | |
| 771 if(axs.utils.isElementHidden(b)) { | |
| 772 return null | |
| 773 } | |
| 774 var c = axs.utils.getBgColor(a, b); | |
| 775 if(!c) { | |
| 776 return null | |
| 777 } | |
| 778 var d = axs.utils.getFgColor(a, b, c); | |
| 779 return d ? axs.utils.calculateContrastRatio(d, c) : null | |
| 780 }; | |
| 781 axs.utils.isNativeTextElement = function(a) { | |
| 782 var b = a.tagName.toLowerCase(); | |
| 783 a = a.type ? a.type.toLowerCase() : ""; | |
| 784 if("textarea" == b) { | |
| 785 return!0 | |
| 786 } | |
| 787 if("input" != b) { | |
| 788 return!1 | |
| 789 } | |
| 790 switch(a) { | |
| 791 case "email": | |
| 792 ; | |
| 793 case "number": | |
| 794 ; | |
| 795 case "password": | |
| 796 ; | |
| 797 case "search": | |
| 798 ; | |
| 799 case "text": | |
| 800 ; | |
| 801 case "tel": | |
| 802 ; | |
| 803 case "url": | |
| 804 ; | |
| 805 case "": | |
| 806 return!0; | |
| 807 default: | |
| 808 return!1 | |
| 809 } | |
| 810 }; | |
| 811 axs.utils.isLowContrast = function(a, b, c) { | |
| 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-labelled by") || axs.utils.isNativeTextElement(a) && a.hasAttribute("placeholder") || a.h asAttribute("id") && 0 < document.querySelectorAll("label[for=" + a.id + "]").le ngth) { | |
| 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("a ria-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.isEleme ntOrAncestorHidden(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_ROL ES[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 = {na me: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.rea son, 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.v alues ? 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 n ot 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.valu e); | |
| 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.v alid = !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.va lid = !1, d.reason ? (d.reason = [d.reason], d.reason.push(c.reason)) : (d.reaso n = c.reason, d.possibleValues = c.possibleValues)), d.values ? d.values.push(c. value) : d.values = [c.value] | |
| 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.HTMLSel ectElement || a instanceof b.HTMLTextAreaElement || a instanceof b.HTMLButtonEle ment || 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.pa rentNode) + " > "); | |
| 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 a = a.getAttribute("tabindex"); | |
| 999 return void 0 != a ? {tabindex:{value:a, valid:!0}} : null | |
| 1000 }; | |
| 1001 axs.properties.getColorProperties = function(a) { | |
| 1002 var b = {}; | |
| 1003 (a = axs.properties.getContrastRatioProperties(a)) && (b.contrastRatio = a); | |
| 1004 return 0 == Object.keys(b).length ? null : b | |
| 1005 }; | |
| 1006 axs.properties.hasDirectTextDescendant = function(a) { | |
| 1007 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()) { | |
| 1008 if(d === a) { | |
| 1009 c = !0; | |
| 1010 break | |
| 1011 } | |
| 1012 } | |
| 1013 return c | |
| 1014 }; | |
| 1015 axs.properties.getContrastRatioProperties = function(a) { | |
| 1016 if(!axs.properties.hasDirectTextDescendant(a)) { | |
| 1017 return null | |
| 1018 } | |
| 1019 var b = {}, c = window.getComputedStyle(a, null), d = axs.utils.getBgColor(c, a); | |
| 1020 if(!d) { | |
| 1021 return null | |
| 1022 } | |
| 1023 b.backgroundColor = axs.utils.colorToString(d); | |
| 1024 var e = axs.utils.getFgColor(c, a, d); | |
| 1025 b.foregroundColor = axs.utils.colorToString(e); | |
| 1026 a = axs.utils.getContrastRatioForElementWithComputedStyle(c, a); | |
| 1027 if(!a) { | |
| 1028 return null | |
| 1029 } | |
| 1030 b.value = a.toFixed(2); | |
| 1031 axs.utils.isLowContrast(a, c) && (b.alert = !0); | |
| 1032 (c = axs.utils.suggestColors(d, e, a, c)) && Object.keys(c).length && (b.sugge stedColors = c); | |
| 1033 return b | |
| 1034 }; | |
| 1035 axs.properties.findTextAlternatives = function(a, b, c) { | |
| 1036 var d = c || !1; | |
| 1037 c = axs.utils.asElement(a); | |
| 1038 if(!c || !d && axs.utils.isElementOrAncestorHidden(c)) { | |
| 1039 return null | |
| 1040 } | |
| 1041 if(a.nodeType == Node.TEXT_NODE) { | |
| 1042 return c = {type:"text"}, c.text = a.textContent, c.lastWord = axs.propertie s.getLastWord(c.text), b.content = c, a.textContent | |
| 1043 } | |
| 1044 a = null; | |
| 1045 d || (a = axs.properties.getTextFromAriaLabelledby(c, b)); | |
| 1046 if(c.hasAttribute("aria-label")) { | |
| 1047 var e = {type:"text"}; | |
| 1048 e.text = c.getAttribute("aria-label"); | |
| 1049 e.lastWord = axs.properties.getLastWord(e.text); | |
| 1050 a ? e.unused = !0 : d && axs.utils.elementIsHtmlControl(c) || (a = e.text); | |
| 1051 b.ariaLabel = e | |
| 1052 } | |
| 1053 c.hasAttribute("role") && "presentation" == c.getAttribute("role") || (a = axs .properties.getTextFromHostLangaugeAttributes(c, b, a)); | |
| 1054 if(d && axs.utils.elementIsHtmlControl(c)) { | |
| 1055 e = c.ownerDocument.defaultView; | |
| 1056 if(c instanceof e.HTMLInputElement) { | |
| 1057 var f = c; | |
| 1058 "text" == f.type && f.value && 0 < f.value.length && (b.controlValue = {te xt:f.value}); | |
| 1059 "range" == f.type && (b.controlValue = {text:f.value}) | |
| 1060 } | |
| 1061 c instanceof e.HTMLSelectElement && (b.controlValue = {text:f.value}); | |
| 1062 b.controlValue && (f = b.controlValue, a ? f.unused = !0 : a = f.text) | |
| 1063 } | |
| 1064 if(d && axs.utils.elementIsAriaWidget(c)) { | |
| 1065 d = c.getAttribute("role"); | |
| 1066 "textbox" == d && c.textContent && 0 < c.textContent.length && (b.controlVal ue = {text:c.textContent}); | |
| 1067 if("slider" == d || "spinbutton" == d) { | |
| 1068 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")}) | |
| 1069 } | |
| 1070 if("menu" == d) { | |
| 1071 for(var g = c.querySelectorAll("[role=menuitemcheckbox], [role=menuitemrad io]"), f = [], e = 0;e < g.length;e++) { | |
| 1072 "true" == g[e].getAttribute("aria-checked") && f.push(g[e]) | |
| 1073 } | |
| 1074 if(0 < f.length) { | |
| 1075 g = ""; | |
| 1076 for(e = 0;e < f.length;e++) { | |
| 1077 g += axs.properties.findTextAlternatives(f[e], {}, !0), e < f.length - 1 && (g += ", ") | |
| 1078 } | |
| 1079 b.controlValue = {text:g} | |
| 1080 } | |
| 1081 } | |
| 1082 if("combobox" == d || "select" == d) { | |
| 1083 b.controlValue = {text:"TODO"} | |
| 1084 } | |
| 1085 b.controlValue && (f = b.controlValue, a ? f.unused = !0 : a = f.text) | |
| 1086 } | |
| 1087 if(d = axs.properties.getTextFromDescendantContent(c)) { | |
| 1088 f = {type:"text"}, f.text = d, f.lastWord = axs.properties.getLastWord(f.tex t), a ? f.unused = !0 : a = d, b.content = f | |
| 1089 } | |
| 1090 c.hasAttribute("title") && (d = {type:"string", valid:!0}, d.text = c.getAttri bute("title"), d.lastWord = axs.properties.getLastWord(d.lastWord), a ? d.unused = !0 : a = d.text, b.title = d); | |
| 1091 return 0 == Object.keys(b).length && null == a ? null : a | |
| 1092 }; | |
| 1093 axs.properties.getTextFromDescendantContent = function(a) { | |
| 1094 if(a.hasAttribute("role")) { | |
| 1095 var b = a.getAttribute("role"); | |
| 1096 if((b = axs.constants.ARIA_ROLES[b]) && (!b.namefrom || 0 > b.namefrom.index Of("contents"))) { | |
| 1097 return null | |
| 1098 } | |
| 1099 } | |
| 1100 a = a.childNodes; | |
| 1101 for(var b = [], c = 0;c < a.length;c++) { | |
| 1102 var d = axs.properties.findTextAlternatives(a[c], {}, !0); | |
| 1103 d && 0 < d.trim().length && b.push(d.trim()) | |
| 1104 } | |
| 1105 return b.length ? b.join(" ") : null | |
| 1106 }; | |
| 1107 axs.properties.getTextFromAriaLabelledby = function(a, b) { | |
| 1108 var c = null; | |
| 1109 if(!a.hasAttribute("aria-labelledby")) { | |
| 1110 return c | |
| 1111 } | |
| 1112 for(var d = a.getAttribute("aria-labelledby").split(/\s+/), e = {valid:!0}, f = [], g = [], h = 0;h < d.length;h++) { | |
| 1113 var k = {type:"element"}, m = d[h]; | |
| 1114 k.value = m; | |
| 1115 var l = document.getElementById(m); | |
| 1116 l ? (k.valid = !0, k.text = axs.properties.findTextAlternatives(l, {}, !0), k.lastWord = axs.properties.getLastWord(k.text), f.push(l.textContent.trim()), k .element = l) : (k.valid = !1, e.valid = !1, k.errorMessage = {messageKey:"noEle mentWithId", args:[m]}); | |
| 1117 g.push(k) | |
| 1118 } | |
| 1119 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); | |
| 1120 return c | |
| 1121 }; | |
| 1122 axs.properties.getTextFromHostLangaugeAttributes = function(a, b, c) { | |
| 1123 if(axs.browserUtils.matchSelector(a, "img")) { | |
| 1124 if(a.hasAttribute("alt")) { | |
| 1125 var d = {type:"string", valid:!0}; | |
| 1126 d.text = a.getAttribute("alt"); | |
| 1127 c ? d.unused = !0 : c = d.text; | |
| 1128 b.alt = d | |
| 1129 }else { | |
| 1130 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}) | |
| 1131 } | |
| 1132 } | |
| 1133 if(axs.browserUtils.matchSelector(a, 'input:not([type="hidden"]):not([disabled ]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), vi deo:not([disabled])')) { | |
| 1134 if(a.hasAttribute("id")) { | |
| 1135 for(var d = document.querySelectorAll("label[for=" + a.id + "]"), e = {}, f = [], g = [], h = 0;h < d.length;h++) { | |
| 1136 var k = {type:"element"}, m = d[h], l = axs.properties.findTextAlternati ves(m, {}, !0); | |
| 1137 l && 0 < l.trim().length && (k.text = l.trim(), g.push(l.trim())); | |
| 1138 k.element = m; | |
| 1139 f.push(k) | |
| 1140 } | |
| 1141 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) | |
| 1142 } | |
| 1143 d = a.parentElement; | |
| 1144 for(e = {};d;) { | |
| 1145 if("label" == d.tagName.toLowerCase() && (f = d, f.control == a)) { | |
| 1146 e.type = "element"; | |
| 1147 e.text = axs.properties.findTextAlternatives(f, {}, !0); | |
| 1148 e.lastWord = axs.properties.getLastWord(e.text); | |
| 1149 e.element = f; | |
| 1150 break | |
| 1151 } | |
| 1152 d = d.parentElement | |
| 1153 } | |
| 1154 e.text && (c ? e.unused = !0 : c = e.text, b.labelWrapped = e); | |
| 1155 Object.keys(b).length || (b.noLabel = !0) | |
| 1156 } | |
| 1157 return c | |
| 1158 }; | |
| 1159 axs.properties.getLastWord = function(a) { | |
| 1160 if(!a) { | |
| 1161 return null | |
| 1162 } | |
| 1163 var b = a.lastIndexOf(" ") + 1, c = a.length - 10; | |
| 1164 return a.substring(b > c ? b : c) | |
| 1165 }; | |
| 1166 axs.properties.getTextProperties = function(a) { | |
| 1167 var b = {}; | |
| 1168 a = axs.properties.findTextAlternatives(a, b); | |
| 1169 if(0 == Object.keys(b).length) { | |
| 1170 if(!a) { | |
| 1171 return null | |
| 1172 } | |
| 1173 b.hasProperties = !1 | |
| 1174 }else { | |
| 1175 b.hasProperties = !0 | |
| 1176 } | |
| 1177 b.computedText = a; | |
| 1178 b.lastWord = axs.properties.getLastWord(a); | |
| 1179 return b | |
| 1180 }; | |
| 1181 axs.properties.getAriaProperties = function(a) { | |
| 1182 var b = {}, c = axs.properties.getGlobalAriaProperties(a), d; | |
| 1183 for(d in axs.constants.ARIA_PROPERTIES) { | |
| 1184 var e = "aria-" + d; | |
| 1185 if(a.hasAttribute(e)) { | |
| 1186 var f = a.getAttribute(e); | |
| 1187 c[e] = axs.utils.getAriaPropertyValue(e, f, a) | |
| 1188 } | |
| 1189 } | |
| 1190 0 < Object.keys(c).length && (b.properties = axs.utils.values(c)); | |
| 1191 f = axs.utils.getRoles(a); | |
| 1192 if(!f) { | |
| 1193 return Object.keys(b).length ? b : null | |
| 1194 } | |
| 1195 b.roles = f; | |
| 1196 if(!f.valid || !f.roles) { | |
| 1197 return b | |
| 1198 } | |
| 1199 for(var e = f.roles, g = 0;g < e.length;g++) { | |
| 1200 var h = e[g]; | |
| 1201 if(h.details && h.details.propertiesSet) { | |
| 1202 for(d in h.details.propertiesSet) { | |
| 1203 d in c || (a.hasAttribute(d) ? (f = a.getAttribute(d), c[d] = axs.utils. getAriaPropertyValue(d, f, a), "values" in c[d] && (f = c[d].values, f[f.length - 1].isLast = !0)) : h.details.requiredPropertiesSet[d] && (c[d] = {name:d, vali d:!1, reason:"Required property not set"})) | |
| 1204 } | |
| 1205 } | |
| 1206 } | |
| 1207 0 < Object.keys(c).length && (b.properties = axs.utils.values(c)); | |
| 1208 return 0 < Object.keys(b).length ? b : null | |
| 1209 }; | |
| 1210 axs.properties.getGlobalAriaProperties = function(a) { | |
| 1211 for(var b = {}, c = 0;c < axs.constants.GLOBAL_PROPERTIES.length;c++) { | |
| 1212 var d = axs.constants.GLOBAL_PROPERTIES[c]; | |
| 1213 if(a.hasAttribute(d)) { | |
| 1214 var e = a.getAttribute(d); | |
| 1215 b[d] = axs.utils.getAriaPropertyValue(d, e, a) | |
| 1216 } | |
| 1217 } | |
| 1218 return b | |
| 1219 }; | |
| 1220 axs.properties.getVideoProperties = function(a) { | |
| 1221 if(!axs.browserUtils.matchSelector(a, "video")) { | |
| 1222 return null | |
| 1223 } | |
| 1224 var b = {}; | |
| 1225 b.captionTracks = axs.properties.getTrackElements(a, "captions"); | |
| 1226 b.descriptionTracks = axs.properties.getTrackElements(a, "descriptions"); | |
| 1227 b.chapterTracks = axs.properties.getTrackElements(a, "chapters"); | |
| 1228 return b | |
| 1229 }; | |
| 1230 axs.properties.getTrackElements = function(a, b) { | |
| 1231 var c = a.querySelectorAll("track[kind=" + b + "]"), d = {}; | |
| 1232 if(!c.length) { | |
| 1233 return d.valid = !1, d.reason = {messageKey:"noTracksProvided", args:[[b]]}, d | |
| 1234 } | |
| 1235 d.valid = !0; | |
| 1236 for(var e = [], f = 0;f < c.length;f++) { | |
| 1237 var g = {}, h = c[f].getAttribute("src"), k = c[f].getAttribute("srcLang"), m = c[f].getAttribute("label"); | |
| 1238 h ? (g.valid = !0, g.src = h) : (g.valid = !1, g.reason = {messageKey:"noSrc Provided"}); | |
| 1239 h = ""; | |
| 1240 m && (h += m, k && (h += " ")); | |
| 1241 k && (h += "(" + k + ")"); | |
| 1242 "" == h && (h = "[[object Object]]"); | |
| 1243 g.name = h; | |
| 1244 e.push(g) | |
| 1245 } | |
| 1246 d.values = e; | |
| 1247 return d | |
| 1248 }; | |
| 1249 axs.properties.getAllProperties = function(a) { | |
| 1250 var b = axs.utils.asElement(a); | |
| 1251 if(!b) { | |
| 1252 return{} | |
| 1253 } | |
| 1254 var c = {}; | |
| 1255 c.ariaProperties = axs.properties.getAriaProperties(b); | |
| 1256 c.colorProperties = axs.properties.getColorProperties(b); | |
| 1257 c.focusProperties = axs.properties.getFocusProperties(b); | |
| 1258 c.textProperties = axs.properties.getTextProperties(a); | |
| 1259 c.videoProperties = axs.properties.getVideoProperties(b); | |
| 1260 return c | |
| 1261 }; | |
| 1262 axs.AuditRule = function(a) { | |
| 1263 for(var b = !0, c = [], d = 0;d < axs.AuditRule.requiredFields.length;d++) { | |
| 1264 var e = axs.AuditRule.requiredFields[d]; | |
| 1265 e in a || (b = !1, c.push(e)) | |
| 1266 } | |
| 1267 if(!b) { | |
| 1268 throw"Invalid spec; the following fields were not specified: " + c.join(", " ) + "\n" + JSON.stringify(a); | |
| 1269 } | |
| 1270 this.name = a.name; | |
| 1271 this.severity = a.severity; | |
| 1272 this.relevantElementMatcher_ = a.relevantElementMatcher; | |
| 1273 this.test_ = a.test; | |
| 1274 this.code = a.code; | |
| 1275 this.heading = a.heading || ""; | |
| 1276 this.url = a.url || ""; | |
| 1277 this.requiresConsoleAPI = !!a.opt_requiresConsoleAPI | |
| 1278 }; | |
| 1279 axs.AuditRule.requiredFields = "name severity relevantElementMatcher test code h eading".split(" "); | |
| 1280 axs.AuditRule.NOT_APPLICABLE = {result:axs.constants.AuditResult.NA}; | |
| 1281 axs.AuditRule.prototype.addElement = function(a, b) { | |
| 1282 a.push(b) | |
| 1283 }; | |
| 1284 axs.AuditRule.collectMatchingElements = function(a, b, c) { | |
| 1285 if(a.nodeType == Node.ELEMENT_NODE) { | |
| 1286 var d = a | |
| 1287 } | |
| 1288 d && b.call(null, d) && c.push(d); | |
| 1289 for(a = a.firstChild;null != a;) { | |
| 1290 axs.AuditRule.collectMatchingElements(a, b, c), a = a.nextSibling | |
| 1291 } | |
| 1292 }; | |
| 1293 axs.AuditRule.prototype.run = function(a, b) { | |
| 1294 var c = a || [], d = []; | |
| 1295 axs.AuditRule.collectMatchingElements(b || document, this.relevantElementMatch er_, d); | |
| 1296 var e = []; | |
| 1297 if(!d.length) { | |
| 1298 return{result:axs.constants.AuditResult.NA} | |
| 1299 } | |
| 1300 for(var f = 0;f < d.length;f++) { | |
| 1301 var g = d[f], h; | |
| 1302 a: { | |
| 1303 h = g; | |
| 1304 for(var k = 0;k < c.length;k++) { | |
| 1305 if(axs.browserUtils.matchSelector(h, c[k])) { | |
| 1306 h = !0; | |
| 1307 break a | |
| 1308 } | |
| 1309 } | |
| 1310 h = !1 | |
| 1311 } | |
| 1312 !h && this.test_(g) && this.addElement(e, g) | |
| 1313 } | |
| 1314 return{result:e.length ? axs.constants.AuditResult.FAIL : axs.constants.AuditR esult.PASS, elements:e} | |
| 1315 }; | |
| 1316 axs.AuditRule.specs = {}; | |
| 1317 axs.AuditRules = {}; | |
| 1318 axs.AuditRules.getRule = function(a) { | |
| 1319 if(!axs.AuditRules.rules) { | |
| 1320 axs.AuditRules.rules = {}; | |
| 1321 for(var b in axs.AuditRule.specs) { | |
| 1322 var c = axs.AuditRule.specs[b], d = new axs.AuditRule(c); | |
| 1323 axs.AuditRules.rules[c.name] = d | |
| 1324 } | |
| 1325 } | |
| 1326 return axs.AuditRules.rules[a] | |
| 1327 }; | |
| 1328 axs.AuditResults = function() { | |
| 1329 this.errors_ = []; | |
| 1330 this.warnings_ = [] | |
| 1331 }; | |
| 1332 goog.exportSymbol("axs.AuditResults", axs.AuditResults); | |
| 1333 axs.AuditResults.prototype.addError = function(a) { | |
| 1334 "" != a && this.errors_.push(a) | |
| 1335 }; | |
| 1336 goog.exportProperty(axs.AuditResults.prototype, "addError", axs.AuditResults.pro totype.addError); | |
| 1337 axs.AuditResults.prototype.addWarning = function(a) { | |
| 1338 "" != a && this.warnings_.push(a) | |
| 1339 }; | |
| 1340 goog.exportProperty(axs.AuditResults.prototype, "addWarning", axs.AuditResults.p rototype.addWarning); | |
| 1341 axs.AuditResults.prototype.numErrors = function() { | |
| 1342 return this.errors_.length | |
| 1343 }; | |
| 1344 goog.exportProperty(axs.AuditResults.prototype, "numErrors", axs.AuditResults.pr ototype.numErrors); | |
| 1345 axs.AuditResults.prototype.numWarnings = function() { | |
| 1346 return this.warnings_.length | |
| 1347 }; | |
| 1348 goog.exportProperty(axs.AuditResults.prototype, "numWarnings", axs.AuditResults. prototype.numWarnings); | |
| 1349 axs.AuditResults.prototype.getErrors = function() { | |
| 1350 return this.errors_ | |
| 1351 }; | |
| 1352 goog.exportProperty(axs.AuditResults.prototype, "getErrors", axs.AuditResults.pr ototype.getErrors); | |
| 1353 axs.AuditResults.prototype.getWarnings = function() { | |
| 1354 return this.warnings_ | |
| 1355 }; | |
| 1356 goog.exportProperty(axs.AuditResults.prototype, "getWarnings", axs.AuditResults. prototype.getWarnings); | |
| 1357 axs.AuditResults.prototype.toString = function() { | |
| 1358 for(var a = "", b = 0;b < this.errors_.length;b++) { | |
| 1359 0 == b && (a += "\nErrors:\n"); | |
| 1360 var c = this.errors_[b], a = a + (c + "\n\n") | |
| 1361 } | |
| 1362 for(b = 0;b < this.warnings_.length;b++) { | |
| 1363 0 == b && (a += "\nWarnings:\n"), c = this.warnings_[b], a += c + "\n\n" | |
| 1364 } | |
| 1365 return a | |
| 1366 }; | |
| 1367 goog.exportProperty(axs.AuditResults.prototype, "toString", axs.AuditResults.pro totype.toString); | |
| 1368 axs.Audit = {}; | |
| 1369 axs.AuditConfiguration = function() { | |
| 1370 this.rules_ = {}; | |
| 1371 this.auditRulesToIgnore = this.auditRulesToRun = this.scope = null; | |
| 1372 this.withConsoleApi = !1; | |
| 1373 goog.exportProperty(this, "scope", this.scope); | |
| 1374 goog.exportProperty(this, "auditRulesToRun", this.auditRulesToRun); | |
| 1375 goog.exportProperty(this, "auditRulesToIgnore", this.auditRulesToIgnore); | |
| 1376 goog.exportProperty(this, "withConsoleApi", this.withConsoleApi) | |
| 1377 }; | |
| 1378 goog.exportSymbol("axs.AuditConfiguration", axs.AuditConfiguration); | |
| 1379 axs.AuditConfiguration.prototype = {ignoreSelectors:function(a, b) { | |
| 1380 a in this.rules_ || (this.rules_[a] = {}); | |
| 1381 "ignore" in this.rules_[a] || (this.rules_[a].ignore = []); | |
| 1382 Array.prototype.push.call(this.rules_[a].ignore, b) | |
| 1383 }, getIgnoreSelectors:function(a) { | |
| 1384 return a in this.rules_ && "ignore" in this.rules_[a] ? this.rules_[a].ignore : [] | |
| 1385 }}; | |
| 1386 goog.exportProperty(axs.AuditConfiguration.prototype, "ignoreSelectors", axs.Aud itConfiguration.prototype.ignoreSelectors); | |
| 1387 goog.exportProperty(axs.AuditConfiguration.prototype, "getIgnoreSelectors", axs. AuditConfiguration.prototype.getIgnoreSelectors); | |
| 1388 axs.Audit.run = function(a) { | |
| 1389 a = a || new axs.AuditConfiguration; | |
| 1390 var b = a.withConsoleApi, c = [], d; | |
| 1391 d = a.auditRulesToRun && 0 < a.auditRulesToRun.length ? a.auditRulesToRun : Ob ject.keys(axs.AuditRule.specs); | |
| 1392 if(a.auditRulesToIgnore) { | |
| 1393 for(var e = 0;e < a.auditRulesToIgnore.length;e++) { | |
| 1394 var f = a.auditRulesToIgnore[e]; | |
| 1395 0 > d.indexOf(f) || d.splice(d.indexOf(f), 1) | |
| 1396 } | |
| 1397 } | |
| 1398 for(e = 0;e < d.length;e++) { | |
| 1399 if((f = axs.AuditRules.getRule(d[e])) && !f.disabled && (b || !f.requiresCon soleAPI)) { | |
| 1400 var g = [], h = a.getIgnoreSelectors(f.name); | |
| 1401 (0 < h.length || a.scope) && g.push(h); | |
| 1402 a.scope && g.push(a.scope); | |
| 1403 g = f.run.apply(f, g); | |
| 1404 g.rule = axs.utils.namedValues(f); | |
| 1405 c.push(g) | |
| 1406 } | |
| 1407 } | |
| 1408 return c | |
| 1409 }; | |
| 1410 goog.exportSymbol("axs.Audit.run", axs.Audit.run); | |
| 1411 axs.Audit.auditResults = function(a) { | |
| 1412 for(var b = new axs.AuditResults, c = 0;c < a.length;c++) { | |
| 1413 var d = a[c]; | |
| 1414 d.result == axs.constants.AuditResult.FAIL && (d.rule.severity == axs.consta nts.Severity.SEVERE ? b.addError(axs.Audit.accessibilityErrorMessage(d)) : b.add Warning(axs.Audit.accessibilityErrorMessage(d))) | |
| 1415 } | |
| 1416 return b | |
| 1417 }; | |
| 1418 goog.exportSymbol("axs.Audit.auditResults", axs.Audit.auditResults); | |
| 1419 axs.Audit.createReport = function(a, b) { | |
| 1420 var c; | |
| 1421 c = "*** Begin accessibility audit results ***\nAn accessibility audit found " + axs.Audit.auditResults(a).toString(); | |
| 1422 b && (c += "\nFor more information, please see ", c += b); | |
| 1423 return c += "\n*** End accessibility audit results ***" | |
| 1424 }; | |
| 1425 goog.exportSymbol("axs.Audit.createReport", axs.Audit.createReport); | |
| 1426 axs.Audit.accessibilityErrorMessage = function(a) { | |
| 1427 for(var b = a.rule.severity == axs.constants.Severity.SEVERE ? "Error: " : "Wa rning: ", b = b + (a.rule.code + " (" + a.rule.heading + ") failed on the follow ing " + (1 == a.elements.length ? "element" : "elements")), b = 1 == a.elements. length ? b + ":" : b + (" (1 - " + Math.min(5, a.elements.length) + " of " + a.e lements.length + "):"), c = Math.min(a.elements.length, 5), d = 0;d < c;d++) { | |
| 1428 var e = a.elements[d], b = b + "\n"; | |
| 1429 try { | |
| 1430 b += axs.utils.getQuerySelectorText(e) | |
| 1431 }catch(f) { | |
| 1432 b += " tagName:" + e.tagName, b += " id:" + e.id | |
| 1433 } | |
| 1434 } | |
| 1435 "" != a.rule.url && (b += "\nSee " + a.rule.url + " for more information."); | |
| 1436 return b | |
| 1437 }; | |
| 1438 goog.exportSymbol("axs.Audit.accessibilityErrorMessage", axs.Audit.accessibility ErrorMessage); | |
| 1439 axs.AuditRule.specs.audioWithoutControls = {name:"audioWithoutControls", heading :"Audio elements should have controls", url:"", severity:axs.constants.Severity. WARNING, relevantElementMatcher:function(a) { | |
| 1440 return axs.browserUtils.matchSelector(a, "audio[autoplay]") | |
| 1441 }, test:function(a) { | |
| 1442 return!a.querySelectorAll("[controls]").length && 3 < a.duration | |
| 1443 }, code:"AX_AUDIO_01"}; | |
| 1444 axs.AuditRule.specs.badAriaAttributeValue = {name:"badAriaAttributeValue", headi ng:"ARIA state and property values must be valid", url:"", severity:axs.constant s.Severity.SEVERE, relevantElementMatcher:function(a) { | |
| 1445 var b = "", c; | |
| 1446 for(c in axs.constants.ARIA_PROPERTIES) { | |
| 1447 b += "[aria-" + c + "]," | |
| 1448 } | |
| 1449 b = b.substring(0, b.length - 1); | |
| 1450 return axs.browserUtils.matchSelector(a, b) | |
| 1451 }, test:function(a) { | |
| 1452 for(var b in axs.constants.ARIA_PROPERTIES) { | |
| 1453 var c = "aria-" + b; | |
| 1454 if(a.hasAttribute(c)) { | |
| 1455 var d = a.getAttribute(c); | |
| 1456 if(!axs.utils.getAriaPropertyValue(c, d, a).valid) { | |
| 1457 return!0 | |
| 1458 } | |
| 1459 } | |
| 1460 } | |
| 1461 return!1 | |
| 1462 }, code:"AX_ARIA_04"}; | |
| 1463 axs.AuditRule.specs.badAriaRole = {name:"badAriaRole", heading:"Elements with AR IA roles must use a valid, non-abstract ARIA role", url:"https://github.com/Goog leChrome/accessibility-developer-tools/wiki/Audit-Rules#-ax_aria_01--elements-wi th-aria-roles-must-use-a-valid-non-abstract-aria-role", severity:axs.constants.S everity.SEVERE, relevantElementMatcher:function(a) { | |
| 1464 return axs.browserUtils.matchSelector(a, "[role]") | |
| 1465 }, test:function(a) { | |
| 1466 return!axs.utils.getRoles(a).valid | |
| 1467 }, code:"AX_ARIA_01"}; | |
| 1468 axs.AuditRule.specs.controlsWithoutLabel = {name:"controlsWithoutLabel", heading :"Controls and media elements should have labels", url:"https://github.com/Googl eChrome/accessibility-developer-tools/wiki/Audit-Rules#-ax_text_01--controls-and -media-elements-should-have-labels", severity:axs.constants.Severity.SEVERE, rel evantElementMatcher:function(a) { | |
| 1469 if(!axs.browserUtils.matchSelector(a, 'input:not([type="hidden"]):not([disable d]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), v ideo:not([disabled])')) { | |
| 1470 return!1 | |
| 1471 } | |
| 1472 if(0 <= a.tabIndex) { | |
| 1473 return!0 | |
| 1474 } | |
| 1475 for(a = a.parentElement;null != a;a = a.parentElement) { | |
| 1476 if(axs.utils.elementIsAriaWidget(a)) { | |
| 1477 return!1 | |
| 1478 } | |
| 1479 } | |
| 1480 return!0 | |
| 1481 }, test:function(a) { | |
| 1482 return axs.utils.isElementOrAncestorHidden(a) || "input" == a.tagName.toLowerC ase() && "button" == a.type && a.value.length || "button" == a.tagName.toLowerCa se() && a.textContent.replace(/^\s+|\s+$/g, "").length ? !1 : axs.utils.hasLabel (a) ? !1 : !0 | |
| 1483 }, code:"AX_TEXT_01", ruleName:"Controls and media elements should have labels"} ; | |
| 1484 axs.AuditRule.specs.focusableElementNotVisibleAndNotAriaHidden = {name:"focusabl eElementNotVisibleAndNotAriaHidden", heading:"These elements are focusable but e ither invisible or obscured by another element", url:"https://github.com/GoogleC hrome/accessibility-developer-tools/wiki/Audit-Rules#-ax_focus_01--these-element s-are-focusable-but-either-invisible-or-obscured-by-another-element", severity:a xs.constants.Severity.WARNING, relevantElementMatcher:function(a) { | |
| 1485 if(!axs.browserUtils.matchSelector(a, axs.utils.FOCUSABLE_ELEMENTS_SELECTOR)) { | |
| 1486 return!1 | |
| 1487 } | |
| 1488 if(0 <= a.tabIndex) { | |
| 1489 return!0 | |
| 1490 } | |
| 1491 for(a = a.parentElement;null != a;a = a.parentElement) { | |
| 1492 if(axs.utils.elementIsAriaWidget(a)) { | |
| 1493 return!1 | |
| 1494 } | |
| 1495 } | |
| 1496 return!0 | |
| 1497 }, test:function(a) { | |
| 1498 return axs.utils.isElementOrAncestorHidden(a) ? !1 : !axs.utils.elementIsVisib le(a) | |
| 1499 }, code:"AX_FOCUS_01"}; | |
| 1500 axs.AuditRule.specs.imagesWithoutAltText = {name:"imagesWithoutAltText", heading :"Images should have an alt attribute", url:"https://github.com/GoogleChrome/acc essibility-developer-tools/wiki/Audit-Rules#-ax_text_02--images-should-have-an-a lt-attribute-unless-they-have-an-aria-role-of-presentation", severity:axs.consta nts.Severity.WARNING, relevantElementMatcher:function(a) { | |
| 1501 return axs.browserUtils.matchSelector(a, "img") && !axs.utils.isElementOrAnces torHidden(a) | |
| 1502 }, test:function(a) { | |
| 1503 return!a.hasAttribute("alt") && "presentation" != a.getAttribute("role") | |
| 1504 }, code:"AX_TEXT_02"}; | |
| 1505 axs.AuditRule.specs.linkWithUnclearPurpose = {name:"linkWithUnclearPurpose", hea ding:"The purpose of each link should be clear from the link text", url:"", seve rity:axs.constants.Severity.WARNING, relevantElementMatcher:function(a) { | |
| 1506 return axs.browserUtils.matchSelector(a, "a") | |
| 1507 }, test:function(a) { | |
| 1508 return/^\s*click\s*here\s*[^a-z]?$/i.test(a.textContent) | |
| 1509 }, code:"AX_TITLE_01"}; | |
| 1510 axs.AuditRule.specs.lowContrastElements = {name:"lowContrastElements", heading:" Text elements should have a reasonable contrast ratio", url:"https://github.com/ GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules#-ax_color_01--text-e lements-should-have-a-reasonable-contrast-ratio", severity:axs.constants.Severit y.WARNING, relevantElementMatcher:function(a) { | |
| 1511 return axs.properties.hasDirectTextDescendant(a) | |
| 1512 }, test:function(a) { | |
| 1513 var b = window.getComputedStyle(a, null); | |
| 1514 return(a = axs.utils.getContrastRatioForElementWithComputedStyle(b, a)) && axs .utils.isLowContrast(a, b) | |
| 1515 }, code:"AX_COLOR_01"}; | |
| 1516 axs.AuditRule.specs.mainRoleOnInappropriateElement = {name:"mainRoleOnInappropri ateElement", heading:"role=main should only appear on significant elements", url :"", severity:axs.constants.Severity.WARNING, relevantElementMatcher:function(a) { | |
| 1517 return axs.browserUtils.matchSelector(a, "[role~=main]") | |
| 1518 }, test:function(a) { | |
| 1519 if(axs.utils.isInlineElement(a)) { | |
| 1520 return!0 | |
| 1521 } | |
| 1522 a = axs.properties.findTextAlternatives(a, {}); | |
| 1523 return!a || 50 > a.length ? !0 : !1 | |
| 1524 }, code:"AX_ARIA_04"}; | |
| 1525 axs.AuditRule.specs.elementsWithMeaningfulBackgroundImage = {name:"elementsWithM eaningfulBackgroundImage", severity:axs.constants.Severity.WARNING, relevantElem entMatcher:function(a) { | |
| 1526 return!axs.utils.isElementOrAncestorHidden(a) | |
| 1527 }, heading:"Meaningful images should not be used in element backgrounds", url:"h ttps://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules#-a x_image_01--meaningful-images-should-not-be-used-in-element-backgrounds", test:f unction(a) { | |
| 1528 if(a.textContent && 0 < a.textContent.length) { | |
| 1529 return!1 | |
| 1530 } | |
| 1531 a = window.getComputedStyle(a, null); | |
| 1532 var b = a.backgroundImage; | |
| 1533 if(!b || "undefined" === b || "none" === b || 0 != b.indexOf("url")) { | |
| 1534 return!1 | |
| 1535 } | |
| 1536 b = parseInt(a.width, 10); | |
| 1537 a = parseInt(a.height, 10); | |
| 1538 return 150 > b && 150 > a | |
| 1539 }, code:"AX_IMAGE_01"}; | |
| 1540 axs.AuditRule.specs.nonExistentAriaLabelledbyElement = {name:"nonExistentAriaLab elledbyElement", heading:"aria-labelledby attributes should refer to an element which exists in the DOM", url:"https://github.com/GoogleChrome/accessibility-dev eloper-tools/wiki/Audit-Rules#-ax_aria_02--aria-labelledby-attributes-should-ref er-to-an-element-which-exists-in-the-dom", severity:axs.constants.Severity.WARNI NG, relevantElementMatcher:function(a) { | |
| 1541 return axs.browserUtils.matchSelector(a, "[aria-labelledby]") | |
| 1542 }, test:function(a) { | |
| 1543 a = a.getAttribute("aria-labelledby").split(/\s+/); | |
| 1544 for(var b = 0;b < a.length;b++) { | |
| 1545 if(!document.getElementById(a[b])) { | |
| 1546 return!0 | |
| 1547 } | |
| 1548 } | |
| 1549 return!1 | |
| 1550 }, code:"AX_ARIA_02"}; | |
| 1551 axs.AuditRule.specs.pageWithoutTitle = {name:"pageWithoutTitle", heading:"The we b page should have a title that describes topic or purpose", url:"", severity:ax s.constants.Severity.WARNING, relevantElementMatcher:function(a) { | |
| 1552 return"html" == a.tagName.toLowerCase() | |
| 1553 }, test:function(a) { | |
| 1554 a = a.querySelector("head"); | |
| 1555 return a ? (a = a.querySelector("title")) ? !a.textContent : !0 : !0 | |
| 1556 }, code:"AX_TITLE_01"}; | |
| 1557 axs.AuditRule.specs.requiredAriaAttributeMissing = {name:"requiredAriaAttributeM issing", heading:"Elements with ARIA roles must have all required attributes for that role", url:"https://github.com/GoogleChrome/accessibility-developer-tools/ wiki/Audit-Rules#-ax_aria_03--elements-with-aria-roles-must-have-all-required-at tributes-for-that-role", severity:axs.constants.Severity.SEVERE, relevantElement Matcher:function(a) { | |
| 1558 return axs.browserUtils.matchSelector(a, "[role]") | |
| 1559 }, test:function(a) { | |
| 1560 var b = axs.utils.getRoles(a); | |
| 1561 if(!b.valid) { | |
| 1562 return!1 | |
| 1563 } | |
| 1564 for(var c = 0;c < b.roles.length;c++) { | |
| 1565 var d = b.roles[c].details.requiredPropertiesSet, e; | |
| 1566 for(e in d) { | |
| 1567 if(d = e.replace(/^aria-/, ""), !("defaultValue" in axs.constants.ARIA_PRO PERTIES[d] || a.hasAttribute(e))) { | |
| 1568 return!0 | |
| 1569 } | |
| 1570 } | |
| 1571 } | |
| 1572 }, code:"AX_ARIA_03"}; | |
| 1573 axs.AuditRule.specs.unfocusableElementsWithOnClick = {name:"unfocusableElementsW ithOnClick", heading:"Elements with onclick handlers must be focusable", url:"ht tps://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules#-ax _focus_02--elements-with-onclick-handlers-must-be-focusable", severity:axs.const ants.Severity.WARNING, opt_requiresConsoleAPI:!0, relevantElementMatcher:functio n(a) { | |
| 1574 return a instanceof a.ownerDocument.defaultView.HTMLBodyElement || axs.utils.i sElementOrAncestorHidden(a) && "selected" == a.className ? !1 : "click" in getEv entListeners(a) ? !0 : !1 | |
| 1575 }, test:function(a) { | |
| 1576 return!a.hasAttribute("tabindex") && !axs.utils.isElementImplicitlyFocusable(a ) | |
| 1577 }, code:"AX_FOCUS_02"}; | |
| 1578 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) { | |
| 1579 return axs.browserUtils.matchSelector(a, "video") | |
| 1580 }, test:function(a) { | |
| 1581 return!a.querySelectorAll("track[kind=captions]").length | |
| 1582 }, code:"AX_VIDEO_01"}; | |
| 1583 | |
| 1584 | |
| OLD | NEW |