| 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/f1baac17140e5f4bc8b6587ea8231df44f80028e |
| 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.cal
l(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.getObjectByN
ame(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 environmen
t" + 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.path
ToNames[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_.len
gth] = 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_ = {pathToN
ames:{}, nameToPath:{}, requires:{}, visited:{}, written:{}}, goog.inHtmlDocumen
t_ = 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.len
gth - 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.propertyIs
Enumerable("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("n
ative 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.evalWo
rksForGlobals_ = !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_ = goo
g.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 ru
nning 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(argumen
ts, 1)) |
| 393 } |
| 394 for(var e = Array.prototype.slice.call(arguments, 2), f = !1, g = a.constructo
r;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 diffe
rent 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.mozMatchesSele
ctor ? a.mozMatchesSelector(b) : !1 |
| 415 }; |
| 416 axs.constants = {}; |
| 417 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", |
| 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"], nam
erequired:!0, parent:["select"], requiredProperties:["aria-expanded"], propertie
s:["aria-expanded", "aria-autocomplete", "aria-required"]}, command:{"abstract":
!0, namefrom:["author"], |
| 419 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"], |
| 420 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"]}, |
| 421 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"]}, |
| 422 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"], |
| 423 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"], |
| 424 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"], |
| 425 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(" ")}, |
| 426 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"], |
| 427 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", |
| 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-orientat
ion"]}, spinbutton:{namefrom:["author"], namerequired:!0, parent:["input", "rang
e"], requiredProperties:["aria-valuemax", |
| 429 "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"], |
| 430 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"], |
| 431 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"]}}; |
| 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", requiredPrope
rtiesSet); |
| 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:"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"}, |
| 468 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", |
| 469 "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"]}, |
| 470 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", |
| 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"}, s
ort:{defaultValue:"none", type:"property", valueType:"token", values:["ascending
", "descending", "none", |
| 472 "other"]}, valuemax:{type:"property", valueType:"decimal"}, valuemin:{type:"prop
erty", valueType:"decimal"}, valuenow:{type:"property", valueType:"decimal"}, va
luetext:{type:"property", valueType:"string"}}; |
| 473 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(" "); |
| 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", 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", |
| 476 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"}; |
| 477 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", |
| 478 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"}; |
| 479 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", |
| 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:{"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", |
| 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", 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", |
| 483 submit:"input_type_submit", tel:"input_type_tel", text:"input_type_text", url:"i
nput_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:"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"}; |
| 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, 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}; |
| 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.b
ody.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.overlappingElement = function(a) { |
| 554 if(axs.utils.elementHasZeroArea(a)) { |
| 555 return null |
| 556 } |
| 557 var b = a.getBoundingClientRect(), b = document.elementFromPoint((b.left + b.r
ight) / 2, (b.top + b.bottom) / 2); |
| 558 return null == b || b == a || axs.utils.isAncestor(b, a) || axs.utils.isAncest
or(a, b) ? null : b |
| 559 }; |
| 560 axs.utils.elementIsHtmlControl = function(a) { |
| 561 var b = a.ownerDocument.defaultView; |
| 562 return a instanceof b.HTMLButtonElement || a instanceof b.HTMLInputElement ||
a instanceof b.HTMLSelectElement || a instanceof b.HTMLTextAreaElement ? !0 : !1 |
| 563 }; |
| 564 axs.utils.elementIsAriaWidget = function(a) { |
| 565 return a.hasAttribute("role") && (a = a.getAttribute("role")) && (a = axs.cons
tants.ARIA_ROLES[a]) && "widget" in a.allParentRolesSet ? !0 : !1 |
| 566 }; |
| 567 axs.utils.elementIsVisible = function(a) { |
| 568 if(axs.utils.elementIsTransparent(a) || axs.utils.elementHasZeroArea(a) || axs
.utils.elementIsOutsideScrollArea(a)) { |
| 569 return!1 |
| 570 } |
| 571 if(a = axs.utils.overlappingElement(a)) { |
| 572 var b = window.getComputedStyle(a, null); |
| 573 if(b && (a = axs.utils.getBgColor(b, a)) && 0 < a.alpha) { |
| 574 return!1 |
| 575 } |
| 576 } |
| 577 return!0 |
| 578 }; |
| 579 axs.utils.isLargeFont = function(a) { |
| 580 var b = a.fontSize; |
| 581 a = "bold" == a.fontWeight; |
| 582 var c = b.match(/(\d+)px/); |
| 583 if(c) { |
| 584 b = parseInt(c[1], 10); |
| 585 if(c = window.getComputedStyle(document.body, null).fontSize.match(/(\d+)px/
)) { |
| 586 var d = parseInt(c[1], 10), c = 1.2 * d, d = 1.5 * d |
| 587 }else { |
| 588 c = 19.2, d = 24 |
| 589 } |
| 590 return a && b >= c || b >= d |
| 591 } |
| 592 if(c = b.match(/(\d+)em/)) { |
| 593 return b = parseInt(c[1], 10), a && 1.2 <= b || 1.5 <= b ? !0 : !1 |
| 594 } |
| 595 if(c = b.match(/(\d+)%/)) { |
| 596 return b = parseInt(c[1], 10), a && 120 <= b || 150 <= b ? !0 : !1 |
| 597 } |
| 598 if(c = b.match(/(\d+)pt/)) { |
| 599 if(b = parseInt(c[1], 10), a && 14 <= b || 14 <= b) { |
| 600 return!0 |
| 601 } |
| 602 } |
| 603 return!1 |
| 604 }; |
| 605 axs.utils.getBgColor = function(a, b) { |
| 606 var c = axs.utils.parseColor(a.backgroundColor); |
| 607 if(!c) { |
| 608 return null |
| 609 } |
| 610 1 > a.opacity && (c.alpha *= a.opacity); |
| 611 if(1 > c.alpha) { |
| 612 var d = axs.utils.getParentBgColor(b); |
| 613 if(null == d) { |
| 614 return null |
| 615 } |
| 616 c = axs.utils.flattenColors(c, d) |
| 617 } |
| 618 return c |
| 619 }; |
| 620 axs.utils.getParentBgColor = function(a) { |
| 621 var b = a; |
| 622 a = []; |
| 623 for(var c = null;b = b.parentElement;) { |
| 624 var d = window.getComputedStyle(b, null); |
| 625 if(d) { |
| 626 var e = axs.utils.parseColor(d.backgroundColor); |
| 627 if(e && (1 > d.opacity && (e.alpha *= d.opacity), 0 != e.alpha && (a.push(
e), 1 == e.alpha))) { |
| 628 c = !0; |
| 629 break |
| 630 } |
| 631 } |
| 632 } |
| 633 c || a.push(new axs.utils.Color(255, 255, 255, 1)); |
| 634 for(b = a.pop();a.length;) { |
| 635 c = a.pop(), b = axs.utils.flattenColors(c, b) |
| 636 } |
| 637 return b |
| 638 }; |
| 639 axs.utils.getFgColor = function(a, b, c) { |
| 640 var d = axs.utils.parseColor(a.color); |
| 641 if(!d) { |
| 642 return null |
| 643 } |
| 644 1 > d.alpha && (d = axs.utils.flattenColors(d, c)); |
| 645 1 > a.opacity && (b = axs.utils.getParentBgColor(b), d.alpha *= a.opacity, d =
axs.utils.flattenColors(d, b)); |
| 646 return d |
| 647 }; |
| 648 axs.utils.parseColor = function(a) { |
| 649 var b = a.match(/^rgb\((\d+), (\d+), (\d+)\)$/); |
| 650 if(b) { |
| 651 a = parseInt(b[1], 10); |
| 652 var c = parseInt(b[2], 10), b = parseInt(b[3], 10), d; |
| 653 return new axs.utils.Color(a, c, b, 1) |
| 654 } |
| 655 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 |
| 656 }; |
| 657 axs.utils.colorChannelToString = function(a) { |
| 658 a = Math.round(a); |
| 659 return 15 >= a ? "0" + a.toString(16) : a.toString(16) |
| 660 }; |
| 661 axs.utils.colorToString = function(a) { |
| 662 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() + ")" |
| 663 }; |
| 664 axs.utils.luminanceFromContrastRatio = function(a, b, c) { |
| 665 return c ? (a + 0.05) * b - 0.05 : (a + 0.05) / b - 0.05 |
| 666 }; |
| 667 axs.utils.translateColor = function(a, b) { |
| 668 var c = a[0], c = (b - c) / ((c > b ? 0 : 1) - c); |
| 669 return axs.utils.fromYCC([b, a[1] - a[1] * c, a[2] - a[2] * c]) |
| 670 }; |
| 671 axs.utils.suggestColors = function(a, b, c, d) { |
| 672 if(!axs.utils.isLowContrast(c, d, !0)) { |
| 673 return null |
| 674 } |
| 675 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); |
| 676 if(axs.utils.isLowContrast(c, d, !1) && 1 >= l && 0 <= l) { |
| 677 var p = axs.utils.translateColor(q, l), l = axs.utils.calculateContrastRatio
(p, a); |
| 678 axs.utils.calculateLuminance(p); |
| 679 f = {}; |
| 680 f.fg = axs.utils.colorToString(p); |
| 681 f.bg = axs.utils.colorToString(a); |
| 682 f.contrast = l.toFixed(2); |
| 683 e.AA = f |
| 684 } |
| 685 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); |
| 686 h = axs.utils.luminanceFromContrastRatio(g, h + 0.02, !m); |
| 687 g = axs.utils.luminanceFromContrastRatio(g, k + 0.02, !m); |
| 688 a = axs.utils.toYCC(a); |
| 689 !("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); |
| 690 !("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); |
| 691 return e |
| 692 }; |
| 693 axs.utils.flattenColors = function(a, b) { |
| 694 var c = a.alpha; |
| 695 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)) |
| 696 }; |
| 697 axs.utils.calculateLuminance = function(a) { |
| 698 return axs.utils.toYCC(a)[0] |
| 699 }; |
| 700 axs.utils.RGBToYCCMatrix = function(a, b) { |
| 701 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)]] |
| 702 }; |
| 703 axs.utils.invert3x3Matrix = function(a) { |
| 704 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]; |
| 705 a = a[2][2]; |
| 706 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))) |
| 707 }; |
| 708 axs.utils.scalarMultiplyMatrix = function(a, b) { |
| 709 for(var c = [[], [], []], d = 0;3 > d;d++) { |
| 710 for(var e = 0;3 > e;e++) { |
| 711 c[d][e] = a[d][e] * b |
| 712 } |
| 713 } |
| 714 return c |
| 715 }; |
| 716 axs.utils.kR = 0.2126; |
| 717 axs.utils.kB = 0.0722; |
| 718 axs.utils.YCC_MATRIX = axs.utils.RGBToYCCMatrix(axs.utils.kR, axs.utils.kB); |
| 719 axs.utils.INVERTED_YCC_MATRIX = axs.utils.invert3x3Matrix(axs.utils.YCC_MATRIX); |
| 720 axs.utils.convertColor = function(a, b) { |
| 721 var c = b[0], d = b[1], e = b[2]; |
| 722 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] |
| 723 }; |
| 724 axs.utils.multiplyMatrices = function(a, b) { |
| 725 for(var c = [[], [], []], d = 0;3 > d;d++) { |
| 726 for(var e = 0;3 > e;e++) { |
| 727 c[d][e] = a[d][0] * b[0][e] + a[d][1] * b[1][e] + a[d][2] * b[2][e] |
| 728 } |
| 729 } |
| 730 return c |
| 731 }; |
| 732 axs.utils.toYCC = function(a) { |
| 733 var b = a.red / 255, c = a.green / 255; |
| 734 a = a.blue / 255; |
| 735 b = 0.03928 >= b ? b / 12.92 : Math.pow((b + 0.055) / 1.055, 2.4); |
| 736 c = 0.03928 >= c ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4); |
| 737 a = 0.03928 >= a ? a / 12.92 : Math.pow((a + 0.055) / 1.055, 2.4); |
| 738 return axs.utils.convertColor(axs.utils.YCC_MATRIX, [b, c, a]) |
| 739 }; |
| 740 axs.utils.fromYCC = function(a) { |
| 741 var b = axs.utils.convertColor(axs.utils.INVERTED_YCC_MATRIX, a), c = b[0]; |
| 742 a = b[1]; |
| 743 b = b[2]; |
| 744 c = 0.00303949 >= c ? 12.92 * c : 1.055 * Math.pow(c, 1 / 2.4) - 0.055; |
| 745 a = 0.00303949 >= a ? 12.92 * a : 1.055 * Math.pow(a, 1 / 2.4) - 0.055; |
| 746 b = 0.00303949 >= b ? 12.92 * b : 1.055 * Math.pow(b, 1 / 2.4) - 0.055; |
| 747 c = Math.min(Math.max(Math.round(255 * c), 0), 255); |
| 748 a = Math.min(Math.max(Math.round(255 * a), 0), 255); |
| 749 b = Math.min(Math.max(Math.round(255 * b), 0), 255); |
| 750 return new axs.utils.Color(c, a, b, 1) |
| 751 }; |
| 752 axs.utils.scalarMultiplyMatrix = function(a, b) { |
| 753 for(var c = [[], [], []], d = 0;3 > d;d++) { |
| 754 for(var e = 0;3 > e;e++) { |
| 755 c[d][e] = a[d][e] * b |
| 756 } |
| 757 } |
| 758 return c |
| 759 }; |
| 760 axs.utils.multiplyMatrices = function(a, b) { |
| 761 for(var c = [[], [], []], d = 0;3 > d;d++) { |
| 762 for(var e = 0;3 > e;e++) { |
| 763 c[d][e] = a[d][0] * b[0][e] + a[d][1] * b[1][e] + a[d][2] * b[2][e] |
| 764 } |
| 765 } |
| 766 return c |
| 767 }; |
| 768 axs.utils.getContrastRatioForElement = function(a) { |
| 769 var b = window.getComputedStyle(a, null); |
| 770 return axs.utils.getContrastRatioForElementWithComputedStyle(b, a) |
| 771 }; |
| 772 axs.utils.getContrastRatioForElementWithComputedStyle = function(a, b) { |
| 773 if(axs.utils.isElementHidden(b)) { |
| 774 return null |
| 775 } |
| 776 var c = axs.utils.getBgColor(a, b); |
| 777 if(!c) { |
| 778 return null |
| 779 } |
| 780 var d = axs.utils.getFgColor(a, b, c); |
| 781 return d ? axs.utils.calculateContrastRatio(d, c) : null |
| 782 }; |
| 783 axs.utils.isNativeTextElement = function(a) { |
| 784 var b = a.tagName.toLowerCase(); |
| 785 a = a.type ? a.type.toLowerCase() : ""; |
| 786 if("textarea" == b) { |
| 787 return!0 |
| 788 } |
| 789 if("input" != b) { |
| 790 return!1 |
| 791 } |
| 792 switch(a) { |
| 793 case "email": |
| 794 ; |
| 795 case "number": |
| 796 ; |
| 797 case "password": |
| 798 ; |
| 799 case "search": |
| 800 ; |
| 801 case "text": |
| 802 ; |
| 803 case "tel": |
| 804 ; |
| 805 case "url": |
| 806 ; |
| 807 case "": |
| 808 return!0; |
| 809 default: |
| 810 return!1 |
| 811 } |
| 812 }; |
| 813 axs.utils.isLowContrast = function(a, b, c) { |
| 814 return c ? 4.5 > a || !axs.utils.isLargeFont(b) && 7 > a : 3 > a || !axs.utils
.isLargeFont(b) && 4.5 > a |
| 815 }; |
| 816 axs.utils.hasLabel = function(a) { |
| 817 var b = a.tagName.toLowerCase(), c = a.type ? a.type.toLowerCase() : ""; |
| 818 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) { |
| 819 return!0 |
| 820 } |
| 821 for(b = a.parentElement;b;) { |
| 822 if("label" == b.tagName.toLowerCase() && b.control == a) { |
| 823 return!0 |
| 824 } |
| 825 b = b.parentElement |
| 826 } |
| 827 return!1 |
| 828 }; |
| 829 axs.utils.isElementHidden = function(a) { |
| 830 if(!(a instanceof a.ownerDocument.defaultView.HTMLElement)) { |
| 831 return!1 |
| 832 } |
| 833 if(a.hasAttribute("chromevoxignoreariahidden")) { |
| 834 var b = !0 |
| 835 } |
| 836 var c = window.getComputedStyle(a, null); |
| 837 return"none" == c.display || "hidden" == c.visibility ? !0 : a.hasAttribute("a
ria-hidden") && "true" == a.getAttribute("aria-hidden").toLowerCase() ? !b : !1 |
| 838 }; |
| 839 axs.utils.isElementOrAncestorHidden = function(a) { |
| 840 return axs.utils.isElementHidden(a) ? !0 : a.parentElement ? axs.utils.isEleme
ntOrAncestorHidden(a.parentElement) : !1 |
| 841 }; |
| 842 axs.utils.isInlineElement = function(a) { |
| 843 a = a.tagName.toUpperCase(); |
| 844 return axs.constants.InlineElements[a] |
| 845 }; |
| 846 axs.utils.getRoles = function(a) { |
| 847 if(!a.hasAttribute("role")) { |
| 848 return!1 |
| 849 } |
| 850 a = a.getAttribute("role").split(" "); |
| 851 for(var b = [], c = !0, d = 0;d < a.length;d++) { |
| 852 var e = a[d]; |
| 853 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) |
| 854 } |
| 855 return{roles:b, valid:c} |
| 856 }; |
| 857 axs.utils.getAriaPropertyValue = function(a, b, c) { |
| 858 var d = a.replace(/^aria-/, ""), e = axs.constants.ARIA_PROPERTIES[d], d = {na
me:a, rawValue:b}; |
| 859 if(!e) { |
| 860 return d.valid = !1, d.reason = '"' + a + '" is not a valid ARIA property',
d |
| 861 } |
| 862 e = e.valueType; |
| 863 if(!e) { |
| 864 return d.valid = !1, d.reason = '"' + a + '" is not a valid ARIA property',
d |
| 865 } |
| 866 switch(e) { |
| 867 case "idref": |
| 868 a = axs.utils.isValidIDRefValue(b, c), d.valid = a.valid, d.reason = a.rea
son, d.idref = a.idref; |
| 869 case "idref_list": |
| 870 a = b.split(/\s+/); |
| 871 d.valid = !0; |
| 872 for(b = 0;b < a.length;b++) { |
| 873 e = axs.utils.isValidIDRefValue(a[b], c), e.valid || (d.valid = !1), d.v
alues ? d.values.push(e) : d.values = [e] |
| 874 } |
| 875 return d; |
| 876 case "integer": |
| 877 ; |
| 878 case "decimal": |
| 879 c = axs.utils.isValidNumber(b); |
| 880 if(!c.valid) { |
| 881 return d.valid = !1, d.reason = c.reason, d |
| 882 } |
| 883 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); |
| 884 return d; |
| 885 case "number": |
| 886 c = axs.utils.isValidNumber(b), c.valid && (d.valid = !0, d.value = c.valu
e); |
| 887 case "string": |
| 888 return d.valid = !0, d.value = b, d; |
| 889 case "token": |
| 890 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; |
| 891 case "token_list": |
| 892 e = b.split(/\s+/); |
| 893 d.valid = !0; |
| 894 for(b = 0;b < e.length;b++) { |
| 895 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] |
| 896 } |
| 897 return d; |
| 898 case "tristate": |
| 899 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; |
| 900 case "boolean": |
| 901 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 |
| 902 } |
| 903 d.valid = !1; |
| 904 d.reason = "Not a valid ARIA property"; |
| 905 return d |
| 906 }; |
| 907 axs.utils.isValidTokenValue = function(a, b) { |
| 908 var c = a.replace(/^aria-/, ""); |
| 909 return axs.utils.isPossibleValue(b, axs.constants.ARIA_PROPERTIES[c].valuesSet
, a) |
| 910 }; |
| 911 axs.utils.isPossibleValue = function(a, b, c) { |
| 912 return b[a] ? {valid:!0, value:a} : {valid:!1, value:a, reason:'"' + a + '" is
not a valid value for ' + c, possibleValues:Object.keys(b)} |
| 913 }; |
| 914 axs.utils.isValidBoolean = function(a) { |
| 915 try { |
| 916 var b = JSON.parse(a) |
| 917 }catch(c) { |
| 918 b = "" |
| 919 } |
| 920 return"boolean" != typeof b ? {valid:!1, value:a, reason:'"' + a + '" is not a
true/false value'} : {valid:!0, value:b} |
| 921 }; |
| 922 axs.utils.isValidIDRefValue = function(a, b) { |
| 923 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 +
'"'} |
| 924 }; |
| 925 axs.utils.isValidNumber = function(a) { |
| 926 try { |
| 927 var b = JSON.parse(a) |
| 928 }catch(c) { |
| 929 return{valid:!1, value:a, reason:'"' + a + '" is not a number'} |
| 930 } |
| 931 return"number" != typeof b ? {valid:!1, value:a, reason:'"' + a + '" is not a
number'} : {valid:!0, value:b} |
| 932 }; |
| 933 axs.utils.isElementImplicitlyFocusable = function(a) { |
| 934 var b = a.ownerDocument.defaultView; |
| 935 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 |
| 936 }; |
| 937 axs.utils.values = function(a) { |
| 938 var b = [], c; |
| 939 for(c in a) { |
| 940 a.hasOwnProperty(c) && "function" != typeof a[c] && b.push(a[c]) |
| 941 } |
| 942 return b |
| 943 }; |
| 944 axs.utils.namedValues = function(a) { |
| 945 var b = {}, c; |
| 946 for(c in a) { |
| 947 a.hasOwnProperty(c) && "function" != typeof a[c] && (b[c] = a[c]) |
| 948 } |
| 949 return b |
| 950 }; |
| 951 axs.utils.getQuerySelectorText = function(a) { |
| 952 if(null == a || "HTML" == a.tagName) { |
| 953 return"html" |
| 954 } |
| 955 if("BODY" == a.tagName) { |
| 956 return"body" |
| 957 } |
| 958 if(a.hasAttribute) { |
| 959 if(a.id) { |
| 960 return"#" + a.id |
| 961 } |
| 962 if(a.className) { |
| 963 for(var b = "", c = 0;c < a.classList.length;c++) { |
| 964 b += "." + a.classList[c] |
| 965 } |
| 966 var d = 0; |
| 967 if(a.parentNode) { |
| 968 for(c = 0;c < a.parentNode.children.length;c++) { |
| 969 var e = a.parentNode.children[c]; |
| 970 axs.browserUtils.matchSelector(e, b) && d++; |
| 971 if(e === a) { |
| 972 break |
| 973 } |
| 974 } |
| 975 }else { |
| 976 d = 1 |
| 977 } |
| 978 return 1 == d ? axs.utils.getQuerySelectorText(a.parentNode) + " > " + b :
axs.utils.getQuerySelectorText(a.parentNode) + " > " + b + ":nth-of-type(" + d
+ ")" |
| 979 } |
| 980 if(a.parentNode) { |
| 981 b = a.parentNode.children; |
| 982 d = 1; |
| 983 for(c = 0;b[c] !== a;) { |
| 984 b[c].tagName == a.tagName && d++, c++ |
| 985 } |
| 986 c = ""; |
| 987 "BODY" != a.parentNode.tagName && (c = axs.utils.getQuerySelectorText(a.pa
rentNode) + " > "); |
| 988 return 1 == d ? c + a.tagName : c + a.tagName + ":nth-of-type(" + d + ")" |
| 989 } |
| 990 }else { |
| 991 if(a.selectorText) { |
| 992 return a.selectorText |
| 993 } |
| 994 } |
| 995 return"" |
| 996 }; |
| 997 axs.properties = {}; |
| 998 axs.properties.TEXT_CONTENT_XPATH = './/text()[normalize-space(.)!=""]/parent::*
[name()!="script"]'; |
| 999 axs.properties.getFocusProperties = function(a) { |
| 1000 a = a.getAttribute("tabindex"); |
| 1001 return void 0 != a ? {tabindex:{value:a, valid:!0}} : null |
| 1002 }; |
| 1003 axs.properties.getColorProperties = function(a) { |
| 1004 var b = {}; |
| 1005 (a = axs.properties.getContrastRatioProperties(a)) && (b.contrastRatio = a); |
| 1006 return 0 == Object.keys(b).length ? null : b |
| 1007 }; |
| 1008 axs.properties.hasDirectTextDescendant = function(a) { |
| 1009 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()) { |
| 1010 if(d === a) { |
| 1011 c = !0; |
| 1012 break |
| 1013 } |
| 1014 } |
| 1015 return c |
| 1016 }; |
| 1017 axs.properties.getContrastRatioProperties = function(a) { |
| 1018 if(!axs.properties.hasDirectTextDescendant(a)) { |
| 1019 return null |
| 1020 } |
| 1021 var b = {}, c = window.getComputedStyle(a, null), d = axs.utils.getBgColor(c,
a); |
| 1022 if(!d) { |
| 1023 return null |
| 1024 } |
| 1025 b.backgroundColor = axs.utils.colorToString(d); |
| 1026 var e = axs.utils.getFgColor(c, a, d); |
| 1027 b.foregroundColor = axs.utils.colorToString(e); |
| 1028 a = axs.utils.getContrastRatioForElementWithComputedStyle(c, a); |
| 1029 if(!a) { |
| 1030 return null |
| 1031 } |
| 1032 b.value = a.toFixed(2); |
| 1033 axs.utils.isLowContrast(a, c) && (b.alert = !0); |
| 1034 (c = axs.utils.suggestColors(d, e, a, c)) && Object.keys(c).length && (b.sugge
stedColors = c); |
| 1035 return b |
| 1036 }; |
| 1037 axs.properties.findTextAlternatives = function(a, b, c) { |
| 1038 var d = c || !1; |
| 1039 c = axs.utils.asElement(a); |
| 1040 if(!c || !d && axs.utils.isElementOrAncestorHidden(c)) { |
| 1041 return null |
| 1042 } |
| 1043 if(a.nodeType == Node.TEXT_NODE) { |
| 1044 return c = {type:"text"}, c.text = a.textContent, c.lastWord = axs.propertie
s.getLastWord(c.text), b.content = c, a.textContent |
| 1045 } |
| 1046 a = null; |
| 1047 d || (a = axs.properties.getTextFromAriaLabelledby(c, b)); |
| 1048 if(c.hasAttribute("aria-label")) { |
| 1049 var e = {type:"text"}; |
| 1050 e.text = c.getAttribute("aria-label"); |
| 1051 e.lastWord = axs.properties.getLastWord(e.text); |
| 1052 a ? e.unused = !0 : d && axs.utils.elementIsHtmlControl(c) || (a = e.text); |
| 1053 b.ariaLabel = e |
| 1054 } |
| 1055 c.hasAttribute("role") && "presentation" == c.getAttribute("role") || (a = axs
.properties.getTextFromHostLangaugeAttributes(c, b, a)); |
| 1056 if(d && axs.utils.elementIsHtmlControl(c)) { |
| 1057 e = c.ownerDocument.defaultView; |
| 1058 if(c instanceof e.HTMLInputElement) { |
| 1059 var f = c; |
| 1060 "text" == f.type && f.value && 0 < f.value.length && (b.controlValue = {te
xt:f.value}); |
| 1061 "range" == f.type && (b.controlValue = {text:f.value}) |
| 1062 } |
| 1063 c instanceof e.HTMLSelectElement && (b.controlValue = {text:f.value}); |
| 1064 b.controlValue && (f = b.controlValue, a ? f.unused = !0 : a = f.text) |
| 1065 } |
| 1066 if(d && axs.utils.elementIsAriaWidget(c)) { |
| 1067 d = c.getAttribute("role"); |
| 1068 "textbox" == d && c.textContent && 0 < c.textContent.length && (b.controlVal
ue = {text:c.textContent}); |
| 1069 if("slider" == d || "spinbutton" == d) { |
| 1070 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")}) |
| 1071 } |
| 1072 if("menu" == d) { |
| 1073 for(var g = c.querySelectorAll("[role=menuitemcheckbox], [role=menuitemrad
io]"), f = [], e = 0;e < g.length;e++) { |
| 1074 "true" == g[e].getAttribute("aria-checked") && f.push(g[e]) |
| 1075 } |
| 1076 if(0 < f.length) { |
| 1077 g = ""; |
| 1078 for(e = 0;e < f.length;e++) { |
| 1079 g += axs.properties.findTextAlternatives(f[e], {}, !0), e < f.length -
1 && (g += ", ") |
| 1080 } |
| 1081 b.controlValue = {text:g} |
| 1082 } |
| 1083 } |
| 1084 if("combobox" == d || "select" == d) { |
| 1085 b.controlValue = {text:"TODO"} |
| 1086 } |
| 1087 b.controlValue && (f = b.controlValue, a ? f.unused = !0 : a = f.text) |
| 1088 } |
| 1089 if(d = axs.properties.getTextFromDescendantContent(c)) { |
| 1090 f = {type:"text"}, f.text = d, f.lastWord = axs.properties.getLastWord(f.tex
t), a ? f.unused = !0 : a = d, b.content = f |
| 1091 } |
| 1092 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); |
| 1093 return 0 == Object.keys(b).length && null == a ? null : a |
| 1094 }; |
| 1095 axs.properties.getTextFromDescendantContent = function(a) { |
| 1096 if(a.hasAttribute("role")) { |
| 1097 var b = a.getAttribute("role"); |
| 1098 if((b = axs.constants.ARIA_ROLES[b]) && (!b.namefrom || 0 > b.namefrom.index
Of("contents"))) { |
| 1099 return null |
| 1100 } |
| 1101 } |
| 1102 a = a.childNodes; |
| 1103 for(var b = [], c = 0;c < a.length;c++) { |
| 1104 var d = axs.properties.findTextAlternatives(a[c], {}, !0); |
| 1105 d && 0 < d.trim().length && b.push(d.trim()) |
| 1106 } |
| 1107 return b.length ? b.join(" ") : null |
| 1108 }; |
| 1109 axs.properties.getTextFromAriaLabelledby = function(a, b) { |
| 1110 var c = null; |
| 1111 if(!a.hasAttribute("aria-labelledby")) { |
| 1112 return c |
| 1113 } |
| 1114 for(var d = a.getAttribute("aria-labelledby").split(/\s+/), e = {valid:!0}, f
= [], g = [], h = 0;h < d.length;h++) { |
| 1115 var k = {type:"element"}, m = d[h]; |
| 1116 k.value = m; |
| 1117 var l = document.getElementById(m); |
| 1118 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]}); |
| 1119 g.push(k) |
| 1120 } |
| 1121 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); |
| 1122 return c |
| 1123 }; |
| 1124 axs.properties.getTextFromHostLangaugeAttributes = function(a, b, c) { |
| 1125 if(axs.browserUtils.matchSelector(a, "img")) { |
| 1126 if(a.hasAttribute("alt")) { |
| 1127 var d = {type:"string", valid:!0}; |
| 1128 d.text = a.getAttribute("alt"); |
| 1129 c ? d.unused = !0 : c = d.text; |
| 1130 b.alt = d |
| 1131 }else { |
| 1132 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}) |
| 1133 } |
| 1134 } |
| 1135 if(axs.browserUtils.matchSelector(a, 'input:not([type="hidden"]):not([disabled
]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), vi
deo:not([disabled])')) { |
| 1136 if(a.hasAttribute("id")) { |
| 1137 for(var d = document.querySelectorAll("label[for=" + a.id + "]"), e = {},
f = [], g = [], h = 0;h < d.length;h++) { |
| 1138 var k = {type:"element"}, m = d[h], l = axs.properties.findTextAlternati
ves(m, {}, !0); |
| 1139 l && 0 < l.trim().length && (k.text = l.trim(), g.push(l.trim())); |
| 1140 k.element = m; |
| 1141 f.push(k) |
| 1142 } |
| 1143 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) |
| 1144 } |
| 1145 d = a.parentElement; |
| 1146 for(e = {};d;) { |
| 1147 if("label" == d.tagName.toLowerCase() && (f = d, f.control == a)) { |
| 1148 e.type = "element"; |
| 1149 e.text = axs.properties.findTextAlternatives(f, {}, !0); |
| 1150 e.lastWord = axs.properties.getLastWord(e.text); |
| 1151 e.element = f; |
| 1152 break |
| 1153 } |
| 1154 d = d.parentElement |
| 1155 } |
| 1156 e.text && (c ? e.unused = !0 : c = e.text, b.labelWrapped = e); |
| 1157 Object.keys(b).length || (b.noLabel = !0) |
| 1158 } |
| 1159 return c |
| 1160 }; |
| 1161 axs.properties.getLastWord = function(a) { |
| 1162 if(!a) { |
| 1163 return null |
| 1164 } |
| 1165 var b = a.lastIndexOf(" ") + 1, c = a.length - 10; |
| 1166 return a.substring(b > c ? b : c) |
| 1167 }; |
| 1168 axs.properties.getTextProperties = function(a) { |
| 1169 var b = {}; |
| 1170 a = axs.properties.findTextAlternatives(a, b); |
| 1171 if(0 == Object.keys(b).length) { |
| 1172 if(!a) { |
| 1173 return null |
| 1174 } |
| 1175 b.hasProperties = !1 |
| 1176 }else { |
| 1177 b.hasProperties = !0 |
| 1178 } |
| 1179 b.computedText = a; |
| 1180 b.lastWord = axs.properties.getLastWord(a); |
| 1181 return b |
| 1182 }; |
| 1183 axs.properties.getAriaProperties = function(a) { |
| 1184 var b = {}, c = axs.properties.getGlobalAriaProperties(a), d; |
| 1185 for(d in axs.constants.ARIA_PROPERTIES) { |
| 1186 var e = "aria-" + d; |
| 1187 if(a.hasAttribute(e)) { |
| 1188 var f = a.getAttribute(e); |
| 1189 c[e] = axs.utils.getAriaPropertyValue(e, f, a) |
| 1190 } |
| 1191 } |
| 1192 0 < Object.keys(c).length && (b.properties = axs.utils.values(c)); |
| 1193 f = axs.utils.getRoles(a); |
| 1194 if(!f) { |
| 1195 return Object.keys(b).length ? b : null |
| 1196 } |
| 1197 b.roles = f; |
| 1198 if(!f.valid || !f.roles) { |
| 1199 return b |
| 1200 } |
| 1201 for(var e = f.roles, g = 0;g < e.length;g++) { |
| 1202 var h = e[g]; |
| 1203 if(h.details && h.details.propertiesSet) { |
| 1204 for(d in h.details.propertiesSet) { |
| 1205 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"})) |
| 1206 } |
| 1207 } |
| 1208 } |
| 1209 0 < Object.keys(c).length && (b.properties = axs.utils.values(c)); |
| 1210 return 0 < Object.keys(b).length ? b : null |
| 1211 }; |
| 1212 axs.properties.getGlobalAriaProperties = function(a) { |
| 1213 for(var b = {}, c = 0;c < axs.constants.GLOBAL_PROPERTIES.length;c++) { |
| 1214 var d = axs.constants.GLOBAL_PROPERTIES[c]; |
| 1215 if(a.hasAttribute(d)) { |
| 1216 var e = a.getAttribute(d); |
| 1217 b[d] = axs.utils.getAriaPropertyValue(d, e, a) |
| 1218 } |
| 1219 } |
| 1220 return b |
| 1221 }; |
| 1222 axs.properties.getVideoProperties = function(a) { |
| 1223 if(!axs.browserUtils.matchSelector(a, "video")) { |
| 1224 return null |
| 1225 } |
| 1226 var b = {}; |
| 1227 b.captionTracks = axs.properties.getTrackElements(a, "captions"); |
| 1228 b.descriptionTracks = axs.properties.getTrackElements(a, "descriptions"); |
| 1229 b.chapterTracks = axs.properties.getTrackElements(a, "chapters"); |
| 1230 return b |
| 1231 }; |
| 1232 axs.properties.getTrackElements = function(a, b) { |
| 1233 var c = a.querySelectorAll("track[kind=" + b + "]"), d = {}; |
| 1234 if(!c.length) { |
| 1235 return d.valid = !1, d.reason = {messageKey:"noTracksProvided", args:[[b]]},
d |
| 1236 } |
| 1237 d.valid = !0; |
| 1238 for(var e = [], f = 0;f < c.length;f++) { |
| 1239 var g = {}, h = c[f].getAttribute("src"), k = c[f].getAttribute("srcLang"),
m = c[f].getAttribute("label"); |
| 1240 h ? (g.valid = !0, g.src = h) : (g.valid = !1, g.reason = {messageKey:"noSrc
Provided"}); |
| 1241 h = ""; |
| 1242 m && (h += m, k && (h += " ")); |
| 1243 k && (h += "(" + k + ")"); |
| 1244 "" == h && (h = "[[object Object]]"); |
| 1245 g.name = h; |
| 1246 e.push(g) |
| 1247 } |
| 1248 d.values = e; |
| 1249 return d |
| 1250 }; |
| 1251 axs.properties.getAllProperties = function(a) { |
| 1252 var b = axs.utils.asElement(a); |
| 1253 if(!b) { |
| 1254 return{} |
| 1255 } |
| 1256 var c = {}; |
| 1257 c.ariaProperties = axs.properties.getAriaProperties(b); |
| 1258 c.colorProperties = axs.properties.getColorProperties(b); |
| 1259 c.focusProperties = axs.properties.getFocusProperties(b); |
| 1260 c.textProperties = axs.properties.getTextProperties(a); |
| 1261 c.videoProperties = axs.properties.getVideoProperties(b); |
| 1262 return c |
| 1263 }; |
| 1264 axs.AuditRule = function(a) { |
| 1265 for(var b = !0, c = [], d = 0;d < axs.AuditRule.requiredFields.length;d++) { |
| 1266 var e = axs.AuditRule.requiredFields[d]; |
| 1267 e in a || (b = !1, c.push(e)) |
| 1268 } |
| 1269 if(!b) { |
| 1270 throw"Invalid spec; the following fields were not specified: " + c.join(", "
) + "\n" + JSON.stringify(a); |
| 1271 } |
| 1272 this.name = a.name; |
| 1273 this.severity = a.severity; |
| 1274 this.relevantElementMatcher_ = a.relevantElementMatcher; |
| 1275 this.test_ = a.test; |
| 1276 this.code = a.code; |
| 1277 this.heading = a.heading || ""; |
| 1278 this.url = a.url || ""; |
| 1279 this.requiresConsoleAPI = !!a.opt_requiresConsoleAPI |
| 1280 }; |
| 1281 axs.AuditRule.requiredFields = "name severity relevantElementMatcher test code h
eading".split(" "); |
| 1282 axs.AuditRule.NOT_APPLICABLE = {result:axs.constants.AuditResult.NA}; |
| 1283 axs.AuditRule.prototype.addElement = function(a, b) { |
| 1284 a.push(b) |
| 1285 }; |
| 1286 axs.AuditRule.collectMatchingElements = function(a, b, c) { |
| 1287 if(a.nodeType == Node.ELEMENT_NODE) { |
| 1288 var d = a |
| 1289 } |
| 1290 d && b.call(null, d) && c.push(d); |
| 1291 for(a = a.firstChild;null != a;) { |
| 1292 axs.AuditRule.collectMatchingElements(a, b, c), a = a.nextSibling |
| 1293 } |
| 1294 }; |
| 1295 axs.AuditRule.prototype.run = function(a, b) { |
| 1296 var c = a || [], d = []; |
| 1297 axs.AuditRule.collectMatchingElements(b || document, this.relevantElementMatch
er_, d); |
| 1298 var e = []; |
| 1299 if(!d.length) { |
| 1300 return{result:axs.constants.AuditResult.NA} |
| 1301 } |
| 1302 for(var f = 0;f < d.length;f++) { |
| 1303 var g = d[f], h; |
| 1304 a: { |
| 1305 h = g; |
| 1306 for(var k = 0;k < c.length;k++) { |
| 1307 if(axs.browserUtils.matchSelector(h, c[k])) { |
| 1308 h = !0; |
| 1309 break a |
| 1310 } |
| 1311 } |
| 1312 h = !1 |
| 1313 } |
| 1314 !h && this.test_(g) && this.addElement(e, g) |
| 1315 } |
| 1316 return{result:e.length ? axs.constants.AuditResult.FAIL : axs.constants.AuditR
esult.PASS, elements:e} |
| 1317 }; |
| 1318 axs.AuditRule.specs = {}; |
| 1319 axs.AuditRules = {}; |
| 1320 axs.AuditRules.getRule = function(a) { |
| 1321 if(!axs.AuditRules.rules) { |
| 1322 axs.AuditRules.rules = {}; |
| 1323 for(var b in axs.AuditRule.specs) { |
| 1324 var c = axs.AuditRule.specs[b], d = new axs.AuditRule(c); |
| 1325 axs.AuditRules.rules[c.name] = d |
| 1326 } |
| 1327 } |
| 1328 return axs.AuditRules.rules[a] |
| 1329 }; |
| 1330 axs.AuditResults = function() { |
| 1331 this.errors_ = []; |
| 1332 this.warnings_ = [] |
| 1333 }; |
| 1334 goog.exportSymbol("axs.AuditResults", axs.AuditResults); |
| 1335 axs.AuditResults.prototype.addError = function(a) { |
| 1336 "" != a && this.errors_.push(a) |
| 1337 }; |
| 1338 goog.exportProperty(axs.AuditResults.prototype, "addError", axs.AuditResults.pro
totype.addError); |
| 1339 axs.AuditResults.prototype.addWarning = function(a) { |
| 1340 "" != a && this.warnings_.push(a) |
| 1341 }; |
| 1342 goog.exportProperty(axs.AuditResults.prototype, "addWarning", axs.AuditResults.p
rototype.addWarning); |
| 1343 axs.AuditResults.prototype.numErrors = function() { |
| 1344 return this.errors_.length |
| 1345 }; |
| 1346 goog.exportProperty(axs.AuditResults.prototype, "numErrors", axs.AuditResults.pr
ototype.numErrors); |
| 1347 axs.AuditResults.prototype.numWarnings = function() { |
| 1348 return this.warnings_.length |
| 1349 }; |
| 1350 goog.exportProperty(axs.AuditResults.prototype, "numWarnings", axs.AuditResults.
prototype.numWarnings); |
| 1351 axs.AuditResults.prototype.getErrors = function() { |
| 1352 return this.errors_ |
| 1353 }; |
| 1354 goog.exportProperty(axs.AuditResults.prototype, "getErrors", axs.AuditResults.pr
ototype.getErrors); |
| 1355 axs.AuditResults.prototype.getWarnings = function() { |
| 1356 return this.warnings_ |
| 1357 }; |
| 1358 goog.exportProperty(axs.AuditResults.prototype, "getWarnings", axs.AuditResults.
prototype.getWarnings); |
| 1359 axs.AuditResults.prototype.toString = function() { |
| 1360 for(var a = "", b = 0;b < this.errors_.length;b++) { |
| 1361 0 == b && (a += "\nErrors:\n"); |
| 1362 var c = this.errors_[b], a = a + (c + "\n\n") |
| 1363 } |
| 1364 for(b = 0;b < this.warnings_.length;b++) { |
| 1365 0 == b && (a += "\nWarnings:\n"), c = this.warnings_[b], a += c + "\n\n" |
| 1366 } |
| 1367 return a |
| 1368 }; |
| 1369 goog.exportProperty(axs.AuditResults.prototype, "toString", axs.AuditResults.pro
totype.toString); |
| 1370 axs.Audit = {}; |
| 1371 axs.AuditConfiguration = function() { |
| 1372 this.rules_ = {}; |
| 1373 this.auditRulesToIgnore = this.auditRulesToRun = this.scope = null; |
| 1374 this.withConsoleApi = !1; |
| 1375 goog.exportProperty(this, "scope", this.scope); |
| 1376 goog.exportProperty(this, "auditRulesToRun", this.auditRulesToRun); |
| 1377 goog.exportProperty(this, "auditRulesToIgnore", this.auditRulesToIgnore); |
| 1378 goog.exportProperty(this, "withConsoleApi", this.withConsoleApi) |
| 1379 }; |
| 1380 goog.exportSymbol("axs.AuditConfiguration", axs.AuditConfiguration); |
| 1381 axs.AuditConfiguration.prototype = {ignoreSelectors:function(a, b) { |
| 1382 a in this.rules_ || (this.rules_[a] = {}); |
| 1383 "ignore" in this.rules_[a] || (this.rules_[a].ignore = []); |
| 1384 Array.prototype.push.call(this.rules_[a].ignore, b) |
| 1385 }, getIgnoreSelectors:function(a) { |
| 1386 return a in this.rules_ && "ignore" in this.rules_[a] ? this.rules_[a].ignore
: [] |
| 1387 }}; |
| 1388 goog.exportProperty(axs.AuditConfiguration.prototype, "ignoreSelectors", axs.Aud
itConfiguration.prototype.ignoreSelectors); |
| 1389 goog.exportProperty(axs.AuditConfiguration.prototype, "getIgnoreSelectors", axs.
AuditConfiguration.prototype.getIgnoreSelectors); |
| 1390 axs.Audit.run = function(a) { |
| 1391 a = a || new axs.AuditConfiguration; |
| 1392 var b = a.withConsoleApi, c = [], d; |
| 1393 d = a.auditRulesToRun && 0 < a.auditRulesToRun.length ? a.auditRulesToRun : Ob
ject.keys(axs.AuditRule.specs); |
| 1394 if(a.auditRulesToIgnore) { |
| 1395 for(var e = 0;e < a.auditRulesToIgnore.length;e++) { |
| 1396 var f = a.auditRulesToIgnore[e]; |
| 1397 0 > d.indexOf(f) || d.splice(d.indexOf(f), 1) |
| 1398 } |
| 1399 } |
| 1400 for(e = 0;e < d.length;e++) { |
| 1401 if((f = axs.AuditRules.getRule(d[e])) && !f.disabled && (b || !f.requiresCon
soleAPI)) { |
| 1402 var g = [], h = a.getIgnoreSelectors(f.name); |
| 1403 (0 < h.length || a.scope) && g.push(h); |
| 1404 a.scope && g.push(a.scope); |
| 1405 g = f.run.apply(f, g); |
| 1406 g.rule = axs.utils.namedValues(f); |
| 1407 c.push(g) |
| 1408 } |
| 1409 } |
| 1410 return c |
| 1411 }; |
| 1412 goog.exportSymbol("axs.Audit.run", axs.Audit.run); |
| 1413 axs.Audit.auditResults = function(a) { |
| 1414 for(var b = new axs.AuditResults, c = 0;c < a.length;c++) { |
| 1415 var d = a[c]; |
| 1416 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))) |
| 1417 } |
| 1418 return b |
| 1419 }; |
| 1420 goog.exportSymbol("axs.Audit.auditResults", axs.Audit.auditResults); |
| 1421 axs.Audit.createReport = function(a, b) { |
| 1422 var c; |
| 1423 c = "*** Begin accessibility audit results ***\nAn accessibility audit found "
+ axs.Audit.auditResults(a).toString(); |
| 1424 b && (c += "\nFor more information, please see ", c += b); |
| 1425 return c += "\n*** End accessibility audit results ***" |
| 1426 }; |
| 1427 goog.exportSymbol("axs.Audit.createReport", axs.Audit.createReport); |
| 1428 axs.Audit.accessibilityErrorMessage = function(a) { |
| 1429 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++) { |
| 1430 var e = a.elements[d], b = b + "\n"; |
| 1431 try { |
| 1432 b += axs.utils.getQuerySelectorText(e) |
| 1433 }catch(f) { |
| 1434 b += " tagName:" + e.tagName, b += " id:" + e.id |
| 1435 } |
| 1436 } |
| 1437 "" != a.rule.url && (b += "\nSee " + a.rule.url + " for more information."); |
| 1438 return b |
| 1439 }; |
| 1440 goog.exportSymbol("axs.Audit.accessibilityErrorMessage", axs.Audit.accessibility
ErrorMessage); |
| 1441 axs.AuditRule.specs.audioWithoutControls = {name:"audioWithoutControls", heading
:"Audio elements should have controls", url:"", severity:axs.constants.Severity.
WARNING, relevantElementMatcher:function(a) { |
| 1442 return axs.browserUtils.matchSelector(a, "audio[autoplay]") |
| 1443 }, test:function(a) { |
| 1444 return!a.querySelectorAll("[controls]").length && 3 < a.duration |
| 1445 }, code:"AX_AUDIO_01"}; |
| 1446 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) { |
| 1447 var b = "", c; |
| 1448 for(c in axs.constants.ARIA_PROPERTIES) { |
| 1449 b += "[aria-" + c + "]," |
| 1450 } |
| 1451 b = b.substring(0, b.length - 1); |
| 1452 return axs.browserUtils.matchSelector(a, b) |
| 1453 }, test:function(a) { |
| 1454 for(var b in axs.constants.ARIA_PROPERTIES) { |
| 1455 var c = "aria-" + b; |
| 1456 if(a.hasAttribute(c)) { |
| 1457 var d = a.getAttribute(c); |
| 1458 if(!axs.utils.getAriaPropertyValue(c, d, a).valid) { |
| 1459 return!0 |
| 1460 } |
| 1461 } |
| 1462 } |
| 1463 return!1 |
| 1464 }, code:"AX_ARIA_04"}; |
| 1465 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) { |
| 1466 return axs.browserUtils.matchSelector(a, "[role]") |
| 1467 }, test:function(a) { |
| 1468 return!axs.utils.getRoles(a).valid |
| 1469 }, code:"AX_ARIA_01"}; |
| 1470 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) { |
| 1471 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])')) { |
| 1472 return!1 |
| 1473 } |
| 1474 if(0 <= a.tabIndex) { |
| 1475 return!0 |
| 1476 } |
| 1477 for(a = a.parentElement;null != a;a = a.parentElement) { |
| 1478 if(axs.utils.elementIsAriaWidget(a)) { |
| 1479 return!1 |
| 1480 } |
| 1481 } |
| 1482 return!0 |
| 1483 }, test:function(a) { |
| 1484 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 |
| 1485 }, code:"AX_TEXT_01", ruleName:"Controls and media elements should have labels"}
; |
| 1486 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) { |
| 1487 if(!axs.browserUtils.matchSelector(a, axs.utils.FOCUSABLE_ELEMENTS_SELECTOR))
{ |
| 1488 return!1 |
| 1489 } |
| 1490 if(0 <= a.tabIndex) { |
| 1491 return!0 |
| 1492 } |
| 1493 for(a = a.parentElement;null != a;a = a.parentElement) { |
| 1494 if(axs.utils.elementIsAriaWidget(a)) { |
| 1495 return!1 |
| 1496 } |
| 1497 } |
| 1498 return!0 |
| 1499 }, test:function(a) { |
| 1500 return axs.utils.isElementOrAncestorHidden(a) ? !1 : !axs.utils.elementIsVisib
le(a) |
| 1501 }, code:"AX_FOCUS_01"}; |
| 1502 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) { |
| 1503 return axs.browserUtils.matchSelector(a, "img") && !axs.utils.isElementOrAnces
torHidden(a) |
| 1504 }, test:function(a) { |
| 1505 return!a.hasAttribute("alt") && "presentation" != a.getAttribute("role") |
| 1506 }, code:"AX_TEXT_02"}; |
| 1507 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) { |
| 1508 return axs.browserUtils.matchSelector(a, "a") |
| 1509 }, test:function(a) { |
| 1510 return/^\s*click\s*here\s*[^a-z]?$/i.test(a.textContent) |
| 1511 }, code:"AX_TITLE_01"}; |
| 1512 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) { |
| 1513 return axs.properties.hasDirectTextDescendant(a) |
| 1514 }, test:function(a) { |
| 1515 var b = window.getComputedStyle(a, null); |
| 1516 return(a = axs.utils.getContrastRatioForElementWithComputedStyle(b, a)) && axs
.utils.isLowContrast(a, b) |
| 1517 }, code:"AX_COLOR_01"}; |
| 1518 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)
{ |
| 1519 return axs.browserUtils.matchSelector(a, "[role~=main]") |
| 1520 }, test:function(a) { |
| 1521 if(axs.utils.isInlineElement(a)) { |
| 1522 return!0 |
| 1523 } |
| 1524 a = axs.properties.findTextAlternatives(a, {}); |
| 1525 return!a || 50 > a.length ? !0 : !1 |
| 1526 }, code:"AX_ARIA_04"}; |
| 1527 axs.AuditRule.specs.elementsWithMeaningfulBackgroundImage = {name:"elementsWithM
eaningfulBackgroundImage", severity:axs.constants.Severity.WARNING, relevantElem
entMatcher:function(a) { |
| 1528 return!axs.utils.isElementOrAncestorHidden(a) |
| 1529 }, 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) { |
| 1530 if(a.textContent && 0 < a.textContent.length) { |
| 1531 return!1 |
| 1532 } |
| 1533 a = window.getComputedStyle(a, null); |
| 1534 var b = a.backgroundImage; |
| 1535 if(!b || "undefined" === b || "none" === b || 0 != b.indexOf("url")) { |
| 1536 return!1 |
| 1537 } |
| 1538 b = parseInt(a.width, 10); |
| 1539 a = parseInt(a.height, 10); |
| 1540 return 150 > b && 150 > a |
| 1541 }, code:"AX_IMAGE_01"}; |
| 1542 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) { |
| 1543 return axs.browserUtils.matchSelector(a, "[aria-labelledby]") |
| 1544 }, test:function(a) { |
| 1545 a = a.getAttribute("aria-labelledby").split(/\s+/); |
| 1546 for(var b = 0;b < a.length;b++) { |
| 1547 if(!document.getElementById(a[b])) { |
| 1548 return!0 |
| 1549 } |
| 1550 } |
| 1551 return!1 |
| 1552 }, code:"AX_ARIA_02"}; |
| 1553 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) { |
| 1554 return"html" == a.tagName.toLowerCase() |
| 1555 }, test:function(a) { |
| 1556 a = a.querySelector("head"); |
| 1557 return a ? (a = a.querySelector("title")) ? !a.textContent : !0 : !0 |
| 1558 }, code:"AX_TITLE_01"}; |
| 1559 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) { |
| 1560 return axs.browserUtils.matchSelector(a, "[role]") |
| 1561 }, test:function(a) { |
| 1562 var b = axs.utils.getRoles(a); |
| 1563 if(!b.valid) { |
| 1564 return!1 |
| 1565 } |
| 1566 for(var c = 0;c < b.roles.length;c++) { |
| 1567 var d = b.roles[c].details.requiredPropertiesSet, e; |
| 1568 for(e in d) { |
| 1569 if(d = e.replace(/^aria-/, ""), !("defaultValue" in axs.constants.ARIA_PRO
PERTIES[d] || a.hasAttribute(e))) { |
| 1570 return!0 |
| 1571 } |
| 1572 } |
| 1573 } |
| 1574 }, code:"AX_ARIA_03"}; |
| 1575 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) { |
| 1576 return a instanceof a.ownerDocument.defaultView.HTMLBodyElement || axs.utils.i
sElementOrAncestorHidden(a) && "selected" == a.className ? !1 : "click" in getEv
entListeners(a) ? !0 : !1 |
| 1577 }, test:function(a) { |
| 1578 return!a.hasAttribute("tabindex") && !axs.utils.isElementImplicitlyFocusable(a
) |
| 1579 }, code:"AX_FOCUS_02"}; |
| 1580 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) { |
| 1581 return axs.browserUtils.matchSelector(a, "video") |
| 1582 }, test:function(a) { |
| 1583 return!a.querySelectorAll("track[kind=captions]").length |
| 1584 }, code:"AX_VIDEO_01"}; |
| 1585 |
| 1586 |
| OLD | NEW |