- commit
- 28be522a44975d37961f34a702cbe5b539401f0f
- parent
- aaa5dbb7ccecd547245c8d2a73c47e4f5c6183c1
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2024-11-01 12:58
rm fuzz was a nice idea, but I don't actually use it all that much
Diffstat
| M | Makefile | 13 | ++----------- |
| D | fuzz.html | 38 | -------------------------------------- |
| D | fuzz.js | 3092 | ------------------------------------------------------------ |
| D | fuzz/fuzzer.js | 51 | --------------------------------------------------- |
| D | fuzz/html.js | 147 | ------------------------------------------------------------ |
| D | fuzz/index.js | 66 | ------------------------------------------------------------ |
| M | package.json | 1 | - |
7 files changed, 2 insertions, 3406 deletions
diff --git a/Makefile b/Makefile
@@ -1,17 +1,8 @@1 -1 all: babel.js fuzz.js-1 1 all: babel.js 2 2 3 3 babel.js: src/babel.js src/axs.js 4 4 npx browserify $< -o $@ 5 56 -1 fuzz.js: fuzz/index.js fuzz/*.js node_modules/aria-api/instrumented.js node_modules/aria-api/lib/name-inst.js7 -1 npx browserify $< -o $@8 -19 -1 node_modules/aria-api/instrumented.js: node_modules/aria-api/index.js10 -1 cat $< | sed 's/name\.js/name-inst\.js/' > $@11 -112 -1 node_modules/aria-api/lib/name-inst.js: node_modules/aria-api/lib/name.js13 -1 npx nyc instrument $< | sed 's/path="[^"]*\/node_modules/path="node_modules/' > $@14 -115 6 .PHONY: clean 16 7 clean:17 -1 rm -f babel.js fuzz.js node_modules/aria-api/instrumented.js node_modules/aria-api/lib/name-inst.js-1 8 rm -f babel.js
diff --git a/fuzz.html b/fuzz.html
@@ -1,38 +0,0 @@1 -1 <!DOCTYPE html>2 -1 <html>3 -1 <head>4 -1 <meta charset="utf-8" />5 -1 <title>Babelacc fuzzer</title>6 -1 <link rel="stylesheet" href="style.css" />7 -1 </head>8 -1 <body>9 -1 <table>10 -1 <thead>11 -1 <tr>12 -1 <th>tested paths</th>13 -1 <th>errors found</th>14 -1 </tr>15 -1 </thead>16 -1 <tbody>17 -1 <tr>18 -1 <td id="ba-fingerprints">0</td>19 -1 <td id="ba-errors">0</td>20 -1 </tr>21 -1 </tbody>22 -1 </table>23 -124 -1 <table>25 -1 <thead>26 -1 <tr>27 -1 <th>HTML</th>28 -1 <th>accdc</th>29 -1 <th>aria-api</th>30 -1 </tr>31 -1 </thead>32 -1 <tbody id="ba-reports"></tbody>33 -1 </table>34 -1 <div id="ba-preview"></div>35 -136 -1 <script src="fuzz.js"></script>37 -1 </body>38 -1 </html>
diff --git a/fuzz.js b/fuzz.js
@@ -1,3092 +0,0 @@1 -1 (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){2 -1 var getFingerprint = function(covPath) {3 -1 var coverage = window.__coverage__[covPath].b;4 -1 var fingerprint = Object.values(coverage).map(x => x.join(':')).join('-');5 -1 for (var key in coverage) {6 -1 for (var i = 0; i < coverage[key].length; i++) {7 -1 coverage[key][i] = 0;8 -1 }9 -1 }10 -1 return fingerprint;11 -1 };12 -113 -1 var run = function(corpus, oracle, covPath, onFingerprint, onReport, done) {14 -1 var fingerprints = [];15 -1 var queue = [];16 -1 var count = 0;17 -1 var batchSize = 10;18 -119 -1 corpus.forEach(function(item) {20 -1 queue.push(item);21 -1 });22 -123 -1 var step = function() {24 -1 for (var i = 0; i < batchSize && queue.length; i++) {25 -1 var item = queue.shift();26 -1 var report = oracle(item);27 -1 var fingerprint = getFingerprint(covPath);28 -129 -1 if (!fingerprints.includes(fingerprint)) {30 -1 fingerprints.push(fingerprint);31 -1 item.mutate().forEach(mutation => queue.push(mutation));32 -1 onFingerprint(fingerprint, fingerprints.length);33 -134 -1 if (report) {35 -1 onReport(report);36 -1 }37 -1 }38 -1 }39 -140 -1 if (queue.length) {41 -1 setTimeout(step);42 -1 } else {43 -1 done();44 -1 }45 -1 };46 -147 -1 step();48 -1 };49 -150 -1 module.exports = {51 -1 'run': run,52 -1 };53 -154 -1 },{}],2:[function(require,module,exports){55 -1 var constants = require('aria-api/lib/constants');56 -157 -1 var attributes = [58 -1 ['role', Object.keys(constants.roles)],59 -1 ['hidden', ['']],60 -1 ['aria-hidden', ['', 'true', 'false']],61 -1 ['aria-label', ['', '__random__']],62 -1 ['title', ['', '__random__']],63 -1 ['value', ['', '__random__']],64 -1 ['placeholder', ['', '__random__']],65 -1 ['alt', ['', '__random__']],66 -1 ['aria-valuenow', ['', '__random__']],67 -1 ['aria-valuetext', ['', '__random__']],68 -1 ['aria-labelledby', ['__randint__']],69 -1 ['aria-owns', ['__randint__']],70 -1 ['list', ['__randint__']],71 -1 ['for', ['__randint__']],72 -1 ['type', ['', '__random__', 'hidden', 'checkbox', 'text', 'password', 'color', 'reset']],73 -1 ['style', ['', '__random__', 'display: none', 'display: block', 'display: inline-block', 'display: inline', 'visibility: hidden']],74 -1 ];75 -176 -1 var tags = ['a', 'button', 'form', 'label', 'input', 'article', 'table', 'td', 'tr', 'th', 'pre', 'legend', 'h1', 'div', 'span', 'fieldset', 'img', 'abbr', 'strong', 'br', 'hr', 'select', 'option'];77 -178 -1 var randomInt = function(n) {79 -1 return Math.floor(Math.random() * n);80 -1 };81 -182 -1 var randomChoice = function(list) {83 -1 return list[randomInt(list.length)];84 -1 };85 -186 -1 var randomString = function(len) {87 -1 var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 -_.,#';88 -1 var result = '';89 -1 for (var i = 0; i < len; i++) {90 -1 result += randomChoice(chars);91 -1 }92 -1 return result;93 -1 };94 -195 -1 function AttributeList(len) {96 -1 this.value = [];97 -1 for (var i = 0; i < len; i++) {98 -1 var attr = randomChoice(attributes);99 -1 var value = randomChoice(attr[1]);100 -1 if (value === '__random__') {101 -1 // shortcut: always use fixed string length102 -1 value = randomString(10);103 -1 } else if (value === '__randint__') {104 -1 value = randomInt(len);105 -1 }106 -1 this.value.push(attr[0] + '="' + value + '"');107 -1 }108 -1 }109 -1110 -1 AttributeList.prototype.shrink = function() {111 -1 var result = [];112 -1 for (var i = 0; i < this.value.length; i++) {113 -1 var item = new AttributeList(0);114 -1 for (var j = 0; j < this.value.length; j++) {115 -1 if (j !== i) {116 -1 item.value.push(this.value[j]);117 -1 }118 -1 }119 -1 result.push(item);120 -1 }121 -1 return result;122 -1 };123 -1124 -1 function Element(len, ctx) {125 -1 ctx = ctx || {k: 0};126 -1 this.tag = randomChoice(tags);127 -1 this.id = ctx.k;128 -1 this.content = ctx.k;129 -1 ctx.k += 1;130 -1 this.attrs = new AttributeList(randomInt(len));131 -1 this.children = new Children(randomInt(len), ctx);132 -1 }133 -1134 -1 Element.prototype.shrink = function() {135 -1 var result = [];136 -1 var tag = this.tag;137 -1 var id = this.id;138 -1 var content = this.content;139 -1 var attrsList = [this.attrs].concat(this.attrs.shrink());140 -1 var childrenList = [this.children].concat(this.children.shrink());141 -1 attrsList.forEach(function(attrs) {142 -1 childrenList.forEach(function(children) {143 -1 if (attrs !== this.attrs || children !== this.children) {144 -1 var item = new Element(0, {});145 -1 item.tag = tag;146 -1 item.id = id;147 -1 item.content = content;148 -1 item.attrs = attrs;149 -1 item.children = children;150 -1 result.push(item);151 -1 }152 -1 });153 -1 });154 -1 return result;155 -1 };156 -1157 -1 Element.prototype.mutate = function() {158 -1 return this.shrink();159 -1 };160 -1161 -1 Element.prototype.toString = function() {162 -1 var s = '<' + this.tag + ' id="' + this.id + '"';163 -1 this.attrs.value.forEach(function(attr) {164 -1 s += ' ' + attr;165 -1 });166 -1 s += '>' + this.content;167 -1 this.children.value.forEach(function(child) {168 -1 s += child.toString();169 -1 });170 -1 s += '</' + this.tag + '>';171 -1 return s;172 -1 };173 -1174 -1 function Children(len, ctx) {175 -1 this.value = [];176 -1 for (var i = 0; i < len; i++) {177 -1 this.value.push(new Element(randomInt(len), ctx));178 -1 }179 -1 }180 -1181 -1 Children.prototype.shrink = function() {182 -1 var result = [];183 -1 for (var i = 0; i < this.value.length; i++) {184 -1 var item = new Children(0, {});185 -1 for (var j = 0; j < this.value.length; j++) {186 -1 if (j !== i) {187 -1 // shortcut: pick random shrink result188 -1 var shrunken = this.value[j].shrink();189 -1 if (shrunken.length) {190 -1 item.value.push(randomChoice(shrunken));191 -1 }192 -1 }193 -1 }194 -1 result.push(item);195 -1 }196 -1 return result;197 -1 };198 -1199 -1 module.exports = {200 -1 'Element': Element,201 -1 };202 -1203 -1 },{"aria-api/lib/constants":7}],3:[function(require,module,exports){204 -1 var ariaApi = require('aria-api/instrumented.js');205 -1 var accdc = require('w3c-alternative-text-computation');206 -1207 -1 var fuzzer = require('./fuzzer');208 -1 var html = require('./html');209 -1210 -1 var preview = document.querySelector('#ba-preview');211 -1 var fingerprints = document.querySelector('#ba-fingerprints');212 -1 var errors = document.querySelector('#ba-errors');213 -1 var reports = document.querySelector('#ba-reports');214 -1215 -1 var oracle = function(input) {216 -1 preview.innerHTML = input.toString();217 -1 var el = preview.querySelector('#test') || preview.children[0] || preview;218 -1 var v1, v2;219 -1220 -1 try {221 -1 v1 = accdc.calcNames(el).name;222 -1 } catch (error) {223 -1 v1 = error;224 -1 }225 -1226 -1 try {227 -1 v2 = ariaApi.getName(el);228 -1 } catch (error) {229 -1 v2 = error;230 -1 }231 -1232 -1 if (v1 !== v2) {233 -1 return {234 -1 'html': preview.innerHTML,235 -1 'v1': v1,236 -1 'v2': v2,237 -1 };238 -1 }239 -1 };240 -1241 -1 var renderReport = function(report) {242 -1 var tr = document.createElement('tr');243 -1 var td1 = document.createElement('td');244 -1 td1.textContent = report.html;245 -1 tr.append(td1);246 -1 var td2 = document.createElement('td');247 -1 td2.textContent = report.v1;248 -1 tr.append(td2);249 -1 var td3 = document.createElement('td');250 -1 td3.textContent = report.v2;251 -1 tr.append(td3);252 -1 return tr;253 -1 };254 -1255 -1 document.addEventListener('DOMContentLoaded', function() {256 -1 var covPath = 'node_modules/aria-api/lib/name.js';257 -1 var corpus = [];258 -1 for (var i = 0; i < 10; i++) {259 -1 corpus.push(new html.Element(10));260 -1 }261 -1 fuzzer.run(corpus, oracle, covPath, function(fingerprint, c) {262 -1 fingerprints.textContent = c;263 -1 }, function(report) {264 -1 reports.append(renderReport(report));265 -1 errors.textContent = reports.children.length;266 -1 }, function() {267 -1 preview.innerHTML = 'DONE';268 -1 });269 -1 });270 -1271 -1 },{"./fuzzer":1,"./html":2,"aria-api/instrumented.js":4,"w3c-alternative-text-computation":10}],4:[function(require,module,exports){272 -1 var query = require('./lib/query.js');273 -1 var name = require('./lib/name-inst.js');274 -1 var atree = require('./lib/atree.js');275 -1276 -1 module.exports = {277 -1 getRole: query.getRole,278 -1 getAttribute: query.getAttribute,279 -1 getName: name.getName,280 -1 getDescription: name.getDescription,281 -1282 -1 matches: query.matches,283 -1 querySelector: query.querySelector,284 -1 querySelectorAll: query.querySelectorAll,285 -1 closest: query.closest,286 -1287 -1 getParentNode: atree.getParentNode,288 -1 getChildNodes: atree.getChildNodes,289 -1 };290 -1291 -1 },{"./lib/atree.js":5,"./lib/name-inst.js":8,"./lib/query.js":9}],5:[function(require,module,exports){292 -1 const attrs = require('./attrs');293 -1294 -1 const _getOwner = function(node, owners) {295 -1 if (node.nodeType === node.ELEMENT_NODE && node.id) {296 -1 const selector = '[aria-owns~="' + CSS.escape(node.id) + '"]';297 -1 if (owners) {298 -1 for (const owner of owners) {299 -1 if (owner.matches(selector)) {300 -1 return owner;301 -1 }302 -1 }303 -1 } else {304 -1 return document.querySelector(selector);305 -1 }306 -1 }307 -1 };308 -1309 -1 const _getParentNode = function(node, owners) {310 -1 return _getOwner(node, owners) || node.parentNode;311 -1 };312 -1313 -1 const detectLoop = function(node, owners) {314 -1 const seen = [node];315 -1 while ((node = _getParentNode(node, owners))) {316 -1 if (seen.includes(node)) {317 -1 return true;318 -1 }319 -1 seen.push(node);320 -1 }321 -1 };322 -1323 -1 const getOwner = function(node, owners) {324 -1 const owner = _getOwner(node, owners);325 -1 if (owner && !detectLoop(node, owners)) {326 -1 return owner;327 -1 }328 -1 };329 -1330 -1 const getParentNode = function(node, owners) {331 -1 return getOwner(node, owners) || node.parentNode;332 -1 };333 -1334 -1 const isHidden = function(node) {335 -1 return node.nodeType === node.ELEMENT_NODE && attrs.getAttribute(node, 'hidden');336 -1 };337 -1338 -1 const getChildNodes = function(node, owners) {339 -1 const childNodes = [];340 -1341 -1 for (let i = 0; i < node.childNodes.length; i++) {342 -1 const child = node.childNodes[i];343 -1 if (!getOwner(child, owners) && !isHidden(child)) {344 -1 childNodes.push(child);345 -1 }346 -1 }347 -1348 -1 if (node.nodeType === node.ELEMENT_NODE) {349 -1 const owns = attrs.getAttribute(node, 'owns') || [];350 -1 for (let i = 0; i < owns.length; i++) {351 -1 const child = document.getElementById(owns[i]);352 -1 // double check with getOwner for consistency353 -1 if (child && getOwner(child, owners) === node && !isHidden(child)) {354 -1 childNodes.push(child);355 -1 }356 -1 }357 -1 }358 -1359 -1 return childNodes;360 -1 };361 -1362 -1 const walk = function(root, fn) {363 -1 const owners = document.querySelectorAll('[aria-owns]');364 -1 let queue = [root];365 -1 while (queue.length) {366 -1 const item = queue.shift();367 -1 fn(item);368 -1 queue = getChildNodes(item, owners).concat(queue);369 -1 }370 -1 };371 -1372 -1 const searchUp = function(node, test) {373 -1 const candidate = getParentNode(node);374 -1 if (candidate) {375 -1 if (test(candidate)) {376 -1 return candidate;377 -1 } else {378 -1 return searchUp(candidate, test);379 -1 }380 -1 }381 -1 };382 -1383 -1 module.exports = {384 -1 'getParentNode': getParentNode,385 -1 'getChildNodes': getChildNodes,386 -1 'walk': walk,387 -1 'searchUp': searchUp,388 -1 };389 -1390 -1 },{"./attrs":6}],6:[function(require,module,exports){391 -1 const constants = require('./constants.js');392 -1393 -1 var unique = function(arr) {394 -1 return arr.filter((a, i) => arr.indexOf(a) === i);395 -1 };396 -1397 -1 var flatten = function(arr) {398 -1 return [].concat.apply([], arr);399 -1 };400 -1401 -1 var normalizeRoles = function(roles, includeAbstract) {402 -1 return unique(roles403 -1 .map(r => constants.aliases[r] || r)404 -1 .filter(r => constants.roles[r])405 -1 .filter(r => includeAbstract || !constants.roles[r].abstract)406 -1 );407 -1 };408 -1409 -1 // candidates can be passed for performance optimization410 -1 const getRole = function(el, candidates) {411 -1 // TODO: filter out any invalid roles (e.g. name or context required)412 -1 const roles = normalizeRoles(413 -1 (el.getAttribute('role') || '').toLowerCase().split(/\s+/)414 -1 );415 -1416 -1 if (roles.length > 1 && candidates) {417 -1 return [roles, candidates];418 -1 } else if (roles.length) {419 -1 for (const role of roles) {420 -1 if (!candidates || candidates.includes(role)) {421 -1 return role;422 -1 }423 -1 }424 -1 } else {425 -1 for (const role of (candidates || Object.keys(constants.roles))) {426 -1 const r = constants.roles[role];427 -1 if (!r.abstract && r.selectors && el.matches(r.selectors.join(','))) {428 -1 return role;429 -1 }430 -1 }431 -1 }432 -1 };433 -1434 -1 const hasRole = function(el, roles) {435 -1 const subRoles = normalizeRoles(roles, true).map(role => {436 -1 return constants.roles[role].subRoles || [role];437 -1 });438 -1 return !!getRole(el, unique(flatten(subRoles)));439 -1 };440 -1441 -1 const getAttribute = function(el, key) {442 -1 if (constants.attributeStrongMapping.hasOwnProperty(key)) {443 -1 const value = el[constants.attributeStrongMapping[key]];444 -1 if (value) {445 -1 return value;446 -1 }447 -1 }448 -1 if (key === 'readonly' && el.contentEditable) {449 -1 return false;450 -1 } else if (key === 'invalid' && el.checkValidity) {451 -1 return !el.checkValidity();452 -1 } else if (key === 'hidden') {453 -1 // workaround for chromium454 -1 if (el.matches('noscript')) {455 -1 return true;456 -1 }457 -1 if (el.matches('details:not([open]) > :not(summary)')) {458 -1 return true;459 -1 }460 -1 const style = window.getComputedStyle(el);461 -1 if (style.display === 'none' || style.visibility === 'hidden' || style.visibility === 'collapse') {462 -1 return true;463 -1 }464 -1 }465 -1466 -1 const type = constants.attributes[key];467 -1 const raw = el.getAttribute('aria-' + key);468 -1469 -1 if (raw) {470 -1 if (type === 'bool') {471 -1 return raw === 'true';472 -1 } else if (type === 'tristate') {473 -1 return raw === 'true' ? true : raw === 'false' ? false : 'mixed';474 -1 } else if (type === 'bool-undefined') {475 -1 return raw === 'true' ? true : raw === 'false' ? false : undefined;476 -1 } else if (type === 'id-list') {477 -1 return raw.split(/\s+/);478 -1 } else if (type === 'integer') {479 -1 return parseInt(raw, 10);480 -1 } else if (type === 'number') {481 -1 return parseFloat(raw);482 -1 } else if (type === 'token-list') {483 -1 return raw.split(/\s+/);484 -1 } else {485 -1 return raw;486 -1 }487 -1 }488 -1489 -1 // TODO490 -1 // autocomplete491 -1 // contextmenu -> aria-haspopup492 -1 // indeterminate -> aria-checked="mixed"493 -1 // list -> aria-controls494 -1495 -1 if (key === 'level') {496 -1 for (let i = 1; i <= 6; i++) {497 -1 if (el.tagName.toLowerCase() === 'h' + i) {498 -1 return i;499 -1 }500 -1 }501 -1 } else if (constants.attributeWeakMapping.hasOwnProperty(key)) {502 -1 return el[constants.attributeWeakMapping[key]];503 -1 }504 -1505 -1 if (key in constants.attrsWithDefaults) {506 -1 const role = getRole(el);507 -1 const defaults = constants.roles[role].defaults;508 -1 if (defaults && defaults.hasOwnProperty(key)) {509 -1 return defaults[key];510 -1 }511 -1 }512 -1513 -1 if (type === 'bool' || type === 'tristate') {514 -1 return false;515 -1 }516 -1 };517 -1518 -1 module.exports = {519 -1 getRole: getRole,520 -1 hasRole: hasRole,521 -1 getAttribute: getAttribute,522 -1 };523 -1524 -1 },{"./constants.js":7}],7:[function(require,module,exports){525 -1 // https://www.w3.org/TR/wai-aria/#state_prop_def526 -1 exports.attributes = {527 -1 'activedescendant': 'id',528 -1 'atomic': 'bool',529 -1 'autocomplete': 'token',530 -1 'braillelabel': 'string',531 -1 'brailleroledescription': 'string',532 -1 'busy': 'bool',533 -1 'checked': 'tristate',534 -1 'colcount': 'int',535 -1 'colindex': 'int',536 -1 'colindextext': 'string',537 -1 'colspan': 'int',538 -1 'controls': 'id-list',539 -1 'current': 'token',540 -1 'describedby': 'id-list',541 -1 'description': 'string',542 -1 'details': 'id',543 -1 'disabled': 'bool',544 -1 'dropeffect': 'token-list',545 -1 'errormessage': 'id',546 -1 'expanded': 'bool-undefined',547 -1 'flowto': 'id-list',548 -1 'grabbed': 'bool-undefined',549 -1 'haspopup': 'token',550 -1 'hidden': 'bool-undefined',551 -1 'invalid': 'token',552 -1 'keyshortcuts': 'string',553 -1 'label': 'string',554 -1 'labelledby': 'id-list',555 -1 'level': 'int',556 -1 'live': 'token',557 -1 'modal': 'bool',558 -1 'multiline': 'bool',559 -1 'multiselectable': 'bool',560 -1 'orientation': 'token',561 -1 'owns': 'id-list',562 -1 'placeholder': 'string',563 -1 'posinset': 'int',564 -1 'pressed': 'tristate',565 -1 'readonly': 'bool',566 -1 'relevant': 'token-list',567 -1 'required': 'bool',568 -1 'roledescription': 'string',569 -1 'rowcount': 'int',570 -1 'rowindex': 'int',571 -1 'rowindextext': 'string',572 -1 'rowspan': 'int',573 -1 'selected': 'bool-undefined',574 -1 'setsize': 'int',575 -1 'sort': 'token',576 -1 'valuemax': 'number',577 -1 'valuemin': 'number',578 -1 'valuenow': 'number',579 -1 'valuetext': 'string',580 -1 };581 -1582 -1 exports.attributeStrongMapping = {583 -1 'disabled': 'disabled',584 -1 'placeholder': 'placeholder',585 -1 'readonly': 'readOnly',586 -1 'required': 'required',587 -1 };588 -1589 -1 exports.attributeWeakMapping = {590 -1 'checked': 'checked',591 -1 'colspan': 'colSpan',592 -1 'expanded': 'open',593 -1 'multiselectable': 'multiple',594 -1 'rowspan': 'rowSpan',595 -1 'selected': 'selected',596 -1 };597 -1598 -1 // https://www.w3.org/TR/html/dom.html#sectioning-content-2599 -1 const scoped = ['article *', 'aside *', 'nav *', 'section *'].join(',');600 -1601 -1 const svgSelectors = function(selector) {602 -1 return [603 -1 // `${selector}:has(> title:not(:empty))`,604 -1 // `${selector}:has(> desc:not(:empty))`,605 -1 `${selector}[aria-label]`,606 -1 `${selector}[aria-roledescription]`,607 -1 `${selector}[aria-labelledby]`,608 -1 `${selector}[aria-describedby]`,609 -1 `${selector}[tabindex]`,610 -1 `${selector}[role]`,611 -1 ];612 -1 };613 -1614 -1 // https://www.w3.org/TR/html-aam-1.0/#html-element-role-mappings615 -1 // https://www.w3.org/TR/wai-aria/roles616 -1 exports.roles = {617 -1 alert: {618 -1 childRoles: ['alertdialog'],619 -1 defaults: {620 -1 'live': 'assertive',621 -1 'atomic': true,622 -1 },623 -1 },624 -1 alertdialog: {},625 -1 application: {},626 -1 article: {627 -1 selectors: ['article'],628 -1 childRoles: ['comment'],629 -1 },630 -1 banner: {631 -1 selectors: [`header:not(main *, ${scoped})`],632 -1 },633 -1 blockquote: {634 -1 selectors: ['blockquote'],635 -1 },636 -1 button: {637 -1 selectors: [638 -1 'button',639 -1 'input[type="button"]',640 -1 'input[type="image"]',641 -1 'input[type="reset"]',642 -1 'input[type="submit"]',643 -1 'summary',644 -1 ],645 -1 nameFromContents: true,646 -1 },647 -1 caption: {648 -1 selectors: ['caption', 'figcaption'],649 -1 },650 -1 cell: {651 -1 selectors: ['td', 'td ~ th:not([scope])'],652 -1 childRoles: ['columnheader', 'gridcell', 'rowheader'],653 -1 nameFromContents: true,654 -1 },655 -1 checkbox: {656 -1 selectors: ['input[type="checkbox"]'],657 -1 childRoles: ['switch'],658 -1 nameFromContents: true,659 -1 defaults: {660 -1 'checked': 'false',661 -1 },662 -1 },663 -1 code: {664 -1 selectors: ['code'],665 -1 },666 -1 columnheader: {667 -1 selectors: ['th[scope="col"]'],668 -1 nameFromContents: true,669 -1 },670 -1 combobox: {671 -1 selectors: [672 -1 'input:not([type])[list]',673 -1 'input[type="email"][list]',674 -1 'input[type="search"][list]',675 -1 'input[type="tel"][list]',676 -1 'input[type="text"][list]',677 -1 'input[type="url"][list]',678 -1 'select:not([size]):not([multiple])',679 -1 'select[size="0"]:not([multiple])',680 -1 'select[size="1"]:not([multiple])',681 -1 ],682 -1 defaults: {683 -1 'expanded': false,684 -1 'haspopup': 'listbox',685 -1 },686 -1 },687 -1 command: {688 -1 abstract: true,689 -1 childRoles: ['button', 'link', 'menuitem'],690 -1 },691 -1 comment: {692 -1 nameFromContents: true,693 -1 },694 -1 complementary: {695 -1 selectors: [696 -1 `aside:not(${scoped})`,697 -1 'aside[aria-label]',698 -1 'aside[aria-labelledby]',699 -1 'aside[title]',700 -1 ],701 -1 },702 -1 composite: {703 -1 abstract: true,704 -1 childRoles: ['grid', 'select', 'spinbutton', 'tablist'],705 -1 },706 -1 contentinfo: {707 -1 selectors: [`footer:not(main *, ${scoped})`],708 -1 },709 -1 definition: {710 -1 selectors: ['dd'],711 -1 },712 -1 deletion: {713 -1 selectors: ['del', 's'],714 -1 },715 -1 dialog: {716 -1 selectors: ['dialog'],717 -1 childRoles: ['alertdialog'],718 -1 },719 -1 'doc-abstract': {},720 -1 'doc-acknowledgments': {},721 -1 'doc-afterword': {},722 -1 'doc-appendix': {},723 -1 'doc-backlink': {724 -1 nameFromContents: true,725 -1 },726 -1 'doc-biblioentry': {},727 -1 'doc-bibliography': {},728 -1 'doc-biblioref': {729 -1 nameFromContents: true,730 -1 },731 -1 'doc-chapter': {},732 -1 'doc-colophon': {},733 -1 'doc-conclusion': {},734 -1 'doc-cover': {},735 -1 'doc-credit': {},736 -1 'doc-credits': {},737 -1 'doc-dedication': {},738 -1 'doc-endnote': {},739 -1 'doc-endnotes': {},740 -1 'doc-epilogue': {},741 -1 'doc-epigraph': {},742 -1 'doc-errata': {},743 -1 'doc-example': {},744 -1 'doc-footnote': {},745 -1 'doc-foreword': {},746 -1 'doc-glossary': {},747 -1 'doc-glossref': {748 -1 nameFromContents: true,749 -1 },750 -1 'doc-index': {},751 -1 'doc-introduction': {},752 -1 'doc-noteref': {753 -1 nameFromContents: true,754 -1 },755 -1 'doc-notice': {},756 -1 'doc-pagebreak': {757 -1 nameFromContents: true,758 -1 },759 -1 'doc-pagefooter': {},760 -1 'doc-pageheader': {},761 -1 'doc-pagelist': {},762 -1 'doc-part': {},763 -1 'doc-preface': {},764 -1 'doc-prologue': {},765 -1 'doc-pullquote': {},766 -1 'doc-qna': {},767 -1 'doc-subtitle': {768 -1 nameFromContents: true,769 -1 },770 -1 'doc-tip': {},771 -1 'doc-toc': {},772 -1 document: {773 -1 selectors: ['html'],774 -1 childRoles: ['article', 'graphics-document'],775 -1 },776 -1 emphasis: {777 -1 selectors: ['em'],778 -1 },779 -1 feed: {},780 -1 figure: {781 -1 selectors: ['figure'],782 -1 childRoles: ['doc-example'],783 -1 },784 -1 form: {785 -1 selectors: ['form[aria-label]', 'form[aria-labelledby]', 'form[title]'],786 -1 },787 -1 generic: {788 -1 selectors: [789 -1 'a:not([*|href])',790 -1 'area:not([*|href])',791 -1 `aside:not(${scoped}):not([aria-label]):not([aria-labelledby]):not([title])`,792 -1 'b',793 -1 'bdi',794 -1 'bdo',795 -1 'body',796 -1 'data',797 -1 'div',798 -1 // footer scoped799 -1 // header scoped800 -1 'i',801 -1 'li:not(ul > li):not(ol > li)',802 -1 'pre',803 -1 'q',804 -1 'samp',805 -1 'section:not([aria-label]):not([aria-labelledby]):not([title])',806 -1 'small',807 -1 'span',808 -1 'u',809 -1 ],810 -1 },811 -1 'graphics-document': {812 -1 selectors: ['svg'],813 -1 },814 -1 'graphics-object': {815 -1 selectors: [816 -1 ...svgSelectors('symbol'),817 -1 ...svgSelectors('use'),818 -1 ],819 -1 },820 -1 'graphics-symbol': {821 -1 selectors: [822 -1 ...svgSelectors('circle'),823 -1 ...svgSelectors('ellipse'),824 -1 ...svgSelectors('line'),825 -1 ...svgSelectors('path'),826 -1 ...svgSelectors('polygon'),827 -1 ...svgSelectors('polyline'),828 -1 ...svgSelectors('rect'),829 -1 ],830 -1 },831 -1 grid: {832 -1 childRoles: ['treegrid'],833 -1 },834 -1 gridcell: {835 -1 childRoles: ['columnheader', 'rowheader'],836 -1 nameFromContents: true,837 -1 },838 -1 group: {839 -1 selectors: [840 -1 'address',841 -1 'details',842 -1 'fieldset',843 -1 'hgroup',844 -1 'optgroup',845 -1 ...svgSelectors('foreignObject'),846 -1 ...svgSelectors('g'),847 -1 'text',848 -1 ...svgSelectors('textPath'),849 -1 ...svgSelectors('tspan'),850 -1 ],851 -1 childRoles: ['row', 'select', 'toolbar', 'graphics-object'],852 -1 },853 -1 heading: {854 -1 selectors: ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'],855 -1 nameFromContents: true,856 -1 defaults: {857 -1 'level': 2,858 -1 },859 -1 },860 -1 image: {861 -1 selectors: [862 -1 'img:not([alt=""])',863 -1 'graphics-symbol',864 -1 ...svgSelectors('image'),865 -1 ...svgSelectors('mesh'),866 -1 ],867 -1 childRoles: ['doc-cover'],868 -1 },869 -1 input: {870 -1 abstract: true,871 -1 childRoles: [872 -1 'checkbox',873 -1 'combobox',874 -1 'option',875 -1 'radio',876 -1 'slider',877 -1 'spinbutton',878 -1 'textbox',879 -1 ],880 -1 },881 -1 insertion: {882 -1 selectors: ['ins'],883 -1 },884 -1 landmark: {885 -1 abstract: true,886 -1 childRoles: [887 -1 'banner',888 -1 'complementary',889 -1 'contentinfo',890 -1 'doc-acknowledgments',891 -1 'doc-afterword',892 -1 'doc-appendix',893 -1 'doc-bibliography',894 -1 'doc-chapter',895 -1 'doc-conclusion',896 -1 'doc-credits',897 -1 'doc-endnotes',898 -1 'doc-epilogue',899 -1 'doc-errata',900 -1 'doc-foreword',901 -1 'doc-glossary',902 -1 'doc-introduction',903 -1 'doc-part',904 -1 'doc-preface',905 -1 'doc-prologue',906 -1 'form',907 -1 'main',908 -1 'navigation',909 -1 'region',910 -1 'search',911 -1 ],912 -1 },913 -1 link: {914 -1 selectors: ['a[*|href]', 'area[href]'],915 -1 childRoles: ['doc-backlink', 'doc-biblioref', 'doc-glossref', 'doc-noteref'],916 -1 nameFromContents: true,917 -1 },918 -1 list: {919 -1 selectors: ['dl', 'ol', 'ul', 'menu'],920 -1 childRoles: ['feed'],921 -1 },922 -1 listbox: {923 -1 selectors: [924 -1 'datalist',925 -1 'select[multiple]',926 -1 'select[size]:not([size="0"]):not([size="1"])',927 -1 ],928 -1 defaults: {929 -1 'orientation': 'vertical',930 -1 },931 -1 },932 -1 listitem: {933 -1 selectors: ['ol > li', 'ul > li'],934 -1 childRoles: ['doc-biblioentry', 'doc-endnote', 'treeitem'],935 -1 },936 -1 log: {937 -1 defaults: {938 -1 'live': 'polite',939 -1 },940 -1 },941 -1 main: {942 -1 selectors: ['main'],943 -1 },944 -1 mark: {945 -1 selectors: ['mark'],946 -1 },947 -1 marquee: {},948 -1 math: {949 -1 selectors: ['math'],950 -1 },951 -1 meter: {952 -1 selectors: ['meter'],953 -1 defaults: {954 -1 'valuemin': 0,955 -1 'valuemax': 100,956 -1 },957 -1 },958 -1 menu: {959 -1 childRoles: ['menubar'],960 -1 defaults: {961 -1 'orientation': 'vertical',962 -1 },963 -1 },964 -1 menubar: {965 -1 defaults: {966 -1 'orientation': 'horizontal',967 -1 },968 -1 },969 -1 menuitem: {970 -1 childRoles: ['menuitemcheckbox', 'menuitemradio'],971 -1 nameFromContents: true,972 -1 },973 -1 menuitemcheckbox: {974 -1 nameFromContents: true,975 -1 defaults: {976 -1 'checked': 'false',977 -1 },978 -1 },979 -1 menuitemradio: {980 -1 nameFromContents: true,981 -1 defaults: {982 -1 'checked': 'false',983 -1 },984 -1 },985 -1 navigation: {986 -1 selectors: ['nav'],987 -1 childRoles: ['doc-index', 'doc-pagelist', 'doc-toc'],988 -1 },989 -1 none: {990 -1 selectors: ['img[alt=""]'],991 -1 },992 -1 note: {993 -1 childRoles: ['doc-notice', 'doc-tip'],994 -1 },995 -1 option: {996 -1 selectors: ['option'],997 -1 childRoles: ['treeitem'],998 -1 nameFromContents: true,999 -1 defaults: {1000 -1 'selected': 'false',1001 -1 },1002 -1 },1003 -1 paragraph: {1004 -1 selectors: ['p'],1005 -1 },1006 -1 progressbar: {1007 -1 selectors: ['progress'],1008 -1 defaults: {1009 -1 'valuemin': 0,1010 -1 'valuemax': 100,1011 -1 },1012 -1 },1013 -1 radio: {1014 -1 selectors: ['input[type="radio"]'],1015 -1 childRoles: ['menuitemradio'],1016 -1 nameFromContents: true,1017 -1 defaults: {1018 -1 'checked': 'false',1019 -1 },1020 -1 },1021 -1 radiogroup: {},1022 -1 range: {1023 -1 abstract: true,1024 -1 childRoles: ['meter', 'progressbar', 'scrollbar', 'slider', 'spinbutton'],1025 -1 },1026 -1 region: {1027 -1 selectors: ['section[aria-label]', 'section[aria-labelledby]', 'section[title]'],1028 -1 },1029 -1 roletype: {1030 -1 abstract: true,1031 -1 childRoles: ['structure', 'widget', 'window'],1032 -1 },1033 -1 row: {1034 -1 selectors: ['tr'],1035 -1 nameFromContents: true,1036 -1 },1037 -1 rowgroup: {1038 -1 selectors: ['tbody', 'thead', 'tfoot'],1039 -1 },1040 -1 rowheader: {1041 -1 selectors: ['th[scope="row"]', 'th:not([scope]):not(td ~ th)'],1042 -1 nameFromContents: true,1043 -1 },1044 -1 scrollbar: {1045 -1 defaults: {1046 -1 'orientation': 'vertical',1047 -1 'valuemin': 0,1048 -1 'valuemax': 100,1049 -1 },1050 -1 },1051 -1 search: {1052 -1 selectors: ['search'],1053 -1 },1054 -1 searchbox: {1055 -1 selectors: ['input[type="search"]:not([list])'],1056 -1 },1057 -1 section: {1058 -1 abstract: true,1059 -1 childRoles: [1060 -1 'alert',1061 -1 'blockquote',1062 -1 'caption',1063 -1 'cell',1064 -1 'code',1065 -1 'definition',1066 -1 'deletion',1067 -1 'doc-abstract',1068 -1 'doc-colophon',1069 -1 'doc-credit',1070 -1 'doc-dedication',1071 -1 'doc-epigraph',1072 -1 'doc-footnote',1073 -1 'doc-pagefooter',1074 -1 'doc-pageheader',1075 -1 'doc-pullquote',1076 -1 'doc-qna',1077 -1 'emphasis',1078 -1 'figure',1079 -1 'group',1080 -1 'image',1081 -1 'insertion',1082 -1 'landmark',1083 -1 'list',1084 -1 'listitem',1085 -1 'log',1086 -1 'mark',1087 -1 'marquee',1088 -1 'math',1089 -1 'note',1090 -1 'paragraph',1091 -1 'status',1092 -1 'strong',1093 -1 'subscript',1094 -1 'suggestion',1095 -1 'superscript',1096 -1 'table',1097 -1 'tabpanel',1098 -1 'term',1099 -1 'time',1100 -1 'tooltip',1101 -1 ],1102 -1 },1103 -1 sectionhead: {1104 -1 abstract: true,1105 -1 childRoles: [1106 -1 'columnheader',1107 -1 'doc-subtitle',1108 -1 'heading',1109 -1 'rowheader',1110 -1 'tab',1111 -1 ],1112 -1 nameFromContents: true,1113 -1 },1114 -1 select: {1115 -1 abstract: true,1116 -1 childRoles: ['listbox', 'menu', 'radiogroup', 'tree'],1117 -1 },1118 -1 separator: {1119 -1 // assume not focussable because <hr> is not1120 -1 selectors: ['hr'],1121 -1 childRoles: ['doc-pagebreak'],1122 -1 defaults: {1123 -1 'orientation': 'horizontal',1124 -1 'valuemin': 0,1125 -1 'valuemax': 100,1126 -1 },1127 -1 },1128 -1 slider: {1129 -1 selectors: ['input[type="range"]'],1130 -1 defaults: {1131 -1 'orientation': 'horizontal',1132 -1 'valuemin': 0,1133 -1 'valuemax': 100,1134 -1 // FIXME: halfway between actual valuemin and valuemax1135 -1 'valuenow': 50,1136 -1 },1137 -1 },1138 -1 spinbutton: {1139 -1 selectors: ['input[type="number"]'],1140 -1 defaults: {1141 -1 // FIXME: no valuemin/valuemax/valuenow1142 -1 },1143 -1 },1144 -1 status: {1145 -1 selectors: ['output'],1146 -1 childRoles: ['timer'],1147 -1 defaults: {1148 -1 'live': 'polite',1149 -1 'atomic': true,1150 -1 },1151 -1 },1152 -1 strong: {1153 -1 selectors: ['strong'],1154 -1 },1155 -1 structure: {1156 -1 abstract: true,1157 -1 childRoles: [1158 -1 'application',1159 -1 'document',1160 -1 'none',1161 -1 'generic',1162 -1 'range',1163 -1 'rowgroup',1164 -1 'section',1165 -1 'sectionhead',1166 -1 'separator',1167 -1 ],1168 -1 },1169 -1 suggestion: {},1170 -1 subscript: {1171 -1 selectors: ['sub'],1172 -1 },1173 -1 superscript: {1174 -1 selectors: ['sup'],1175 -1 },1176 -1 switch: {1177 -1 nameFromContents: true,1178 -1 defaults: {1179 -1 'checked': false,1180 -1 },1181 -1 },1182 -1 tab: {1183 -1 nameFromContents: true,1184 -1 defaults: {1185 -1 'selected': false,1186 -1 },1187 -1 },1188 -1 table: {1189 -1 selectors: ['table'],1190 -1 childRoles: ['grid'],1191 -1 },1192 -1 tablist: {1193 -1 defaults: {1194 -1 'orientation': 'horizontal',1195 -1 },1196 -1 },1197 -1 tabpanel: {},1198 -1 term: {1199 -1 selectors: ['dfn', 'dt'],1200 -1 },1201 -1 textbox: {1202 -1 selectors: [1203 -1 'input:not([type]):not([list])',1204 -1 'input[type="email"]:not([list])',1205 -1 'input[type="tel"]:not([list])',1206 -1 'input[type="text"]:not([list])',1207 -1 'input[type="url"]:not([list])',1208 -1 'textarea',1209 -1 ],1210 -1 childRoles: ['searchbox'],1211 -1 },1212 -1 time: {1213 -1 selectors: ['time'],1214 -1 },1215 -1 timer: {1216 -1 defaults: {1217 -1 'live': 'off',1218 -1 },1219 -1 },1220 -1 toolbar: {1221 -1 defaults: {1222 -1 'orientation': 'horizontal',1223 -1 },1224 -1 },1225 -1 tooltip: {1226 -1 nameFromContents: true,1227 -1 },1228 -1 tree: {1229 -1 childRoles: ['treegrid'],1230 -1 defaults: {1231 -1 'orientation': 'vertical',1232 -1 },1233 -1 },1234 -1 treegrid: {},1235 -1 treeitem: {1236 -1 nameFromContents: true,1237 -1 },1238 -1 widget: {1239 -1 abstract: true,1240 -1 childRoles: [1241 -1 'command',1242 -1 'composite',1243 -1 'gridcell',1244 -1 'input',1245 -1 'progressbar',1246 -1 'row',1247 -1 'scrollbar',1248 -1 'separator',1249 -1 'tab',1250 -1 ],1251 -1 },1252 -1 window: {1253 -1 abstract: true,1254 -1 childRoles: ['dialog'],1255 -1 },1256 -1 };1257 -11258 -1 const getSubRoles = function(role) {1259 -1 const children = (exports.roles[role]).childRoles || [];1260 -1 const descendents = children.map(getSubRoles);1261 -11262 -1 const result = [role];1263 -11264 -1 descendents.forEach(list => {1265 -1 list.forEach(r => {1266 -1 if (!result.includes(r)) {1267 -1 result.push(r);1268 -1 }1269 -1 });1270 -1 });1271 -11272 -1 return result;1273 -1 };1274 -11275 -1 exports.attrsWithDefaults = [];1276 -11277 -1 for (const role in exports.roles) {1278 -1 exports.roles[role].subRoles = getSubRoles(role);1279 -1 for (const key in exports.roles[role].defaults) {1280 -1 if (!exports.attrsWithDefaults.includes(key)) {1281 -1 exports.attrsWithDefaults.push(key);1282 -1 }1283 -1 }1284 -1 }1285 -11286 -1 exports.aliases = {1287 -1 'presentation': 'none',1288 -1 'directory': 'list',1289 -1 'img': 'image',1290 -1 };1291 -11292 -1 exports.nameFromDescendant = {1293 -1 'figure': 'figcaption',1294 -1 'table': 'caption',1295 -1 'fieldset': 'legend',1296 -1 };1297 -11298 -1 exports.nameDefaults = {1299 -1 'input[type="submit"]': 'Submit',1300 -1 'input[type="reset"]': 'Reset',1301 -1 'summary': 'Details',1302 -1 };1303 -11304 -1 },{}],8:[function(require,module,exports){1305 -1 function cov_22i8nvh4cs(){var path="node_modules/aria-api/lib/name.js";var hash="33fb1e8c5c5d4b85b7cbe0185f2673ac454be0c8";var global=new Function("return this")();var gcv="__coverage__";var coverageData={path:"/home/tobias/code/a11y/babelacc/node_modules/aria-api/lib/name.js",statementMap:{"0":{start:{line:1,column:18},end:{line:1,column:43}},"1":{start:{line:2,column:14},end:{line:2,column:35}},"2":{start:{line:3,column:14},end:{line:3,column:35}},"3":{start:{line:5,column:18},end:{line:10,column:1}},"4":{start:{line:7,column:16},end:{line:7,column:59}},"5":{start:{line:8,column:16},end:{line:8,column:43}},"6":{start:{line:9,column:1},end:{line:9,column:36}},"7":{start:{line:12,column:25},end:{line:39,column:1}},"8":{start:{line:13,column:16},end:{line:13,column:59}},"9":{start:{line:14,column:12},end:{line:14,column:53}},"10":{start:{line:15,column:11},end:{line:15,column:13}},"11":{start:{line:18,column:1},end:{line:36,column:2}},"12":{start:{line:19,column:2},end:{line:34,column:3}},"13":{start:{line:20,column:3},end:{line:20,column:22}},"14":{start:{line:21,column:9},end:{line:34,column:3}},"15":{start:{line:22,column:3},end:{line:24,column:4}},"16":{start:{line:23,column:4},end:{line:23,column:46}},"17":{start:{line:25,column:9},end:{line:34,column:3}},"18":{start:{line:26,column:3},end:{line:28,column:4}},"19":{start:{line:27,column:4},end:{line:27,column:18}},"20":{start:{line:29,column:9},end:{line:34,column:3}},"21":{start:{line:30,column:3},end:{line:30,column:12}},"22":{start:{line:33,column:3},end:{line:33,column:13}},"23":{start:{line:35,column:2},end:{line:35,column:44}},"24":{start:{line:38,column:1},end:{line:38,column:52}},"25":{start:{line:41,column:19},end:{line:59,column:1}},"26":{start:{line:42,column:18},end:{line:42,column:43}},"27":{start:{line:44,column:11},end:{line:44,column:13}},"28":{start:{line:45,column:1},end:{line:56,column:2}},"29":{start:{line:45,column:14},end:{line:45,column:15}},"30":{start:{line:46,column:15},end:{line:46,column:26}},"31":{start:{line:47,column:2},end:{line:55,column:3}},"32":{start:{line:48,column:3},end:{line:48,column:27}},"33":{start:{line:49,column:9},end:{line:55,column:3}},"34":{start:{line:50,column:3},end:{line:54,column:4}},"35":{start:{line:51,column:4},end:{line:51,column:16}},"36":{start:{line:53,column:4},end:{line:53,column:59}},"37":{start:{line:58,column:1},end:{line:58,column:12}},"38":{start:{line:61,column:29},end:{line:66,column:1}},"39":{start:{line:62,column:14},end:{line:62,column:31}},"40":{start:{line:63,column:1},end:{line:65,column:2}},"41":{start:{line:64,column:2},end:{line:64,column:48}},"42":{start:{line:68,column:16},end:{line:183,column:1}},"43":{start:{line:69,column:11},end:{line:69,column:13}},"44":{start:{line:71,column:1},end:{line:71,column:25}},"45":{start:{line:72,column:1},end:{line:78,column:2}},"46":{start:{line:73,column:2},end:{line:75,column:3}},"47":{start:{line:74,column:3},end:{line:74,column:13}},"48":{start:{line:77,column:2},end:{line:77,column:19}},"49":{start:{line:84,column:1},end:{line:91,column:2}},"50":{start:{line:85,column:14},end:{line:85,column:61}},"51":{start:{line:86,column:18},end:{line:89,column:4}},"52":{start:{line:87,column:17},end:{line:87,column:44}},"53":{start:{line:88,column:3},end:{line:88,column:65}},"54":{start:{line:90,column:2},end:{line:90,column:26}},"55":{start:{line:94,column:1},end:{line:107,column:2}},"56":{start:{line:95,column:2},end:{line:106,column:3}},"57":{start:{line:96,column:3},end:{line:96,column:36}},"58":{start:{line:97,column:9},end:{line:106,column:3}},"59":{start:{line:98,column:20},end:{line:98,column:93}},"60":{start:{line:99,column:3},end:{line:103,column:4}},"61":{start:{line:100,column:4},end:{line:100,column:67}},"62":{start:{line:102,column:4},end:{line:102,column:25}},"63":{start:{line:104,column:9},end:{line:106,column:3}},"64":{start:{line:105,column:3},end:{line:105,column:102}},"65":{start:{line:110,column:1},end:{line:113,column:2}},"66":{start:{line:112,column:2},end:{line:112,column:38}},"67":{start:{line:116,column:1},end:{line:121,column:2}},"68":{start:{line:117,column:18},end:{line:119,column:4}},"69":{start:{line:118,column:3},end:{line:118,column:59}},"70":{start:{line:120,column:2},end:{line:120,column:26}},"71":{start:{line:122,column:1},end:{line:124,column:2}},"72":{start:{line:123,column:2},end:{line:123,column:21}},"73":{start:{line:125,column:1},end:{line:127,column:2}},"74":{start:{line:126,column:2},end:{line:126,column:17}},"75":{start:{line:128,column:1},end:{line:137,column:2}},"76":{start:{line:129,column:2},end:{line:136,column:3}},"77":{start:{line:130,column:3},end:{line:135,column:4}},"78":{start:{line:131,column:23},end:{line:131,column:79}},"79":{start:{line:132,column:4},end:{line:134,column:5}},"80":{start:{line:133,column:5},end:{line:133,column:65}},"81":{start:{line:138,column:1},end:{line:143,column:2}},"82":{start:{line:139,column:19},end:{line:139,column:44}},"83":{start:{line:140,column:2},end:{line:142,column:3}},"84":{start:{line:141,column:3},end:{line:141,column:30}},"85":{start:{line:144,column:1},end:{line:146,column:2}},"86":{start:{line:145,column:2},end:{line:145,column:45}},"87":{start:{line:150,column:1},end:{line:152,column:2}},"88":{start:{line:151,column:2},end:{line:151,column:51}},"89":{start:{line:154,column:1},end:{line:156,column:2}},"90":{start:{line:155,column:2},end:{line:155,column:23}},"91":{start:{line:158,column:1},end:{line:164,column:2}},"92":{start:{line:159,column:2},end:{line:163,column:3}},"93":{start:{line:160,column:3},end:{line:162,column:4}},"94":{start:{line:161,column:4},end:{line:161,column:43}},"95":{start:{line:170,column:1},end:{line:172,column:2}},"96":{start:{line:171,column:2},end:{line:171,column:41}},"97":{start:{line:176,column:1},end:{line:178,column:2}},"98":{start:{line:177,column:2},end:{line:177,column:12}},"99":{start:{line:180,column:16},end:{line:180,column:47}},"100":{start:{line:181,column:15},end:{line:181,column:45}},"101":{start:{line:182,column:1},end:{line:182,column:44}},"102":{start:{line:185,column:23},end:{line:190,column:1}},"103":{start:{line:186,column:1},end:{line:189,column:21}},"104":{start:{line:192,column:23},end:{line:223,column:1}},"105":{start:{line:193,column:11},end:{line:193,column:13}},"106":{start:{line:195,column:1},end:{line:211,column:2}},"107":{start:{line:196,column:14},end:{line:196,column:62}},"108":{start:{line:197,column:18},end:{line:200,column:4}},"109":{start:{line:198,column:17},end:{line:198,column:44}},"110":{start:{line:199,column:3},end:{line:199,column:50}},"111":{start:{line:201,column:2},end:{line:201,column:26}},"112":{start:{line:202,column:8},end:{line:211,column:2}},"113":{start:{line:203,column:2},end:{line:203,column:44}},"114":{start:{line:204,column:8},end:{line:211,column:2}},"115":{start:{line:205,column:18},end:{line:205,column:42}},"116":{start:{line:206,column:2},end:{line:208,column:3}},"117":{start:{line:207,column:3},end:{line:207,column:29}},"118":{start:{line:209,column:8},end:{line:211,column:2}},"119":{start:{line:210,column:2},end:{line:210,column:17}},"120":{start:{line:212,column:1},end:{line:214,column:2}},"121":{start:{line:213,column:2},end:{line:213,column:45}},"122":{start:{line:216,column:1},end:{line:216,column:47}},"123":{start:{line:218,column:1},end:{line:220,column:2}},"124":{start:{line:219,column:2},end:{line:219,column:11}},"125":{start:{line:222,column:1},end:{line:222,column:12}},"126":{start:{line:225,column:0},end:{line:228,column:2}}},fnMap:{"0":{name:"(anonymous_0)",decl:{start:{line:5,column:18},end:{line:5,column:19}},loc:{start:{line:5,column:53},end:{line:10,column:1}},line:5},"1":{name:"(anonymous_1)",decl:{start:{line:12,column:25},end:{line:12,column:26}},loc:{start:{line:12,column:54},end:{line:39,column:1}},line:12},"2":{name:"(anonymous_2)",decl:{start:{line:41,column:19},end:{line:41,column:20}},loc:{start:{line:41,column:62},end:{line:59,column:1}},line:41},"3":{name:"(anonymous_3)",decl:{start:{line:61,column:29},end:{line:61,column:30}},loc:{start:{line:61,column:42},end:{line:66,column:1}},line:61},"4":{name:"(anonymous_4)",decl:{start:{line:68,column:16},end:{line:68,column:17}},loc:{start:{line:68,column:85},end:{line:183,column:1}},line:68},"5":{name:"(anonymous_5)",decl:{start:{line:86,column:26},end:{line:86,column:27}},loc:{start:{line:86,column:32},end:{line:89,column:3}},line:86},"6":{name:"(anonymous_6)",decl:{start:{line:117,column:54},end:{line:117,column:55}},loc:{start:{line:117,column:63},end:{line:119,column:3}},line:117},"7":{name:"(anonymous_7)",decl:{start:{line:185,column:23},end:{line:185,column:24}},loc:{start:{line:185,column:36},end:{line:190,column:1}},line:185},"8":{name:"(anonymous_8)",decl:{start:{line:192,column:23},end:{line:192,column:24}},loc:{start:{line:192,column:36},end:{line:223,column:1}},line:192},"9":{name:"(anonymous_9)",decl:{start:{line:197,column:26},end:{line:197,column:27}},loc:{start:{line:197,column:32},end:{line:200,column:3}},line:197}},branchMap:{"0":{loc:{start:{line:9,column:8},end:{line:9,column:35}},type:"cond-expr",locations:[{start:{line:9,column:17},end:{line:9,column:21}},{start:{line:9,column:24},end:{line:9,column:35}}],line:9},"1":{loc:{start:{line:19,column:2},end:{line:34,column:3}},type:"if",locations:[{start:{line:19,column:2},end:{line:34,column:3}},{start:{line:19,column:2},end:{line:34,column:3}}],line:19},"2":{loc:{start:{line:21,column:9},end:{line:34,column:3}},type:"if",locations:[{start:{line:21,column:9},end:{line:34,column:3}},{start:{line:21,column:9},end:{line:34,column:3}}],line:21},"3":{loc:{start:{line:22,column:3},end:{line:24,column:4}},type:"if",locations:[{start:{line:22,column:3},end:{line:24,column:4}},{start:{line:22,column:3},end:{line:24,column:4}}],line:22},"4":{loc:{start:{line:23,column:13},end:{line:23,column:44}},type:"binary-expr",locations:[{start:{line:23,column:13},end:{line:23,column:38}},{start:{line:23,column:42},end:{line:23,column:44}}],line:23},"5":{loc:{start:{line:25,column:9},end:{line:34,column:3}},type:"if",locations:[{start:{line:25,column:9},end:{line:34,column:3}},{start:{line:25,column:9},end:{line:34,column:3}}],line:25},"6":{loc:{start:{line:26,column:3},end:{line:28,column:4}},type:"if",locations:[{start:{line:26,column:3},end:{line:28,column:4}},{start:{line:26,column:3},end:{line:28,column:4}}],line:26},"7":{loc:{start:{line:26,column:7},end:{line:26,column:62}},type:"binary-expr",locations:[{start:{line:26,column:7},end:{line:26,column:32}},{start:{line:26,column:36},end:{line:26,column:62}}],line:26},"8":{loc:{start:{line:29,column:9},end:{line:34,column:3}},type:"if",locations:[{start:{line:29,column:9},end:{line:34,column:3}},{start:{line:29,column:9},end:{line:34,column:3}}],line:29},"9":{loc:{start:{line:47,column:2},end:{line:55,column:3}},type:"if",locations:[{start:{line:47,column:2},end:{line:55,column:3}},{start:{line:47,column:2},end:{line:55,column:3}}],line:47},"10":{loc:{start:{line:49,column:9},end:{line:55,column:3}},type:"if",locations:[{start:{line:49,column:9},end:{line:55,column:3}},{start:{line:49,column:9},end:{line:55,column:3}}],line:49},"11":{loc:{start:{line:50,column:3},end:{line:54,column:4}},type:"if",locations:[{start:{line:50,column:3},end:{line:54,column:4}},{start:{line:50,column:3},end:{line:54,column:4}}],line:50},"12":{loc:{start:{line:63,column:1},end:{line:65,column:2}},type:"if",locations:[{start:{line:63,column:1},end:{line:65,column:2}},{start:{line:63,column:1},end:{line:65,column:2}}],line:63},"13":{loc:{start:{line:71,column:11},end:{line:71,column:24}},type:"binary-expr",locations:[{start:{line:71,column:11},end:{line:71,column:18}},{start:{line:71,column:22},end:{line:71,column:24}}],line:71},"14":{loc:{start:{line:72,column:1},end:{line:78,column:2}},type:"if",locations:[{start:{line:72,column:1},end:{line:78,column:2}},{start:{line:72,column:1},end:{line:78,column:2}}],line:72},"15":{loc:{start:{line:73,column:2},end:{line:75,column:3}},type:"if",locations:[{start:{line:73,column:2},end:{line:75,column:3}},{start:{line:73,column:2},end:{line:75,column:3}}],line:73},"16":{loc:{start:{line:84,column:1},end:{line:91,column:2}},type:"if",locations:[{start:{line:84,column:1},end:{line:91,column:2}},{start:{line:84,column:1},end:{line:91,column:2}}],line:84},"17":{loc:{start:{line:84,column:5},end:{line:84,column:58}},type:"binary-expr",locations:[{start:{line:84,column:5},end:{line:84,column:23}},{start:{line:84,column:27},end:{line:84,column:58}}],line:84},"18":{loc:{start:{line:88,column:10},end:{line:88,column:64}},type:"cond-expr",locations:[{start:{line:88,column:18},end:{line:88,column:59}},{start:{line:88,column:62},end:{line:88,column:64}}],line:88},"19":{loc:{start:{line:94,column:1},end:{line:107,column:2}},type:"if",locations:[{start:{line:94,column:1},end:{line:107,column:2}},{start:{line:94,column:1},end:{line:107,column:2}}],line:94},"20":{loc:{start:{line:94,column:5},end:{line:94,column:29}},type:"binary-expr",locations:[{start:{line:94,column:5},end:{line:94,column:16}},{start:{line:94,column:20},end:{line:94,column:29}}],line:94},"21":{loc:{start:{line:95,column:2},end:{line:106,column:3}},type:"if",locations:[{start:{line:95,column:2},end:{line:106,column:3}},{start:{line:95,column:2},end:{line:106,column:3}}],line:95},"22":{loc:{start:{line:96,column:9},end:{line:96,column:35}},type:"binary-expr",locations:[{start:{line:96,column:9},end:{line:96,column:17}},{start:{line:96,column:21},end:{line:96,column:35}}],line:96},"23":{loc:{start:{line:97,column:9},end:{line:106,column:3}},type:"if",locations:[{start:{line:97,column:9},end:{line:106,column:3}},{start:{line:97,column:9},end:{line:106,column:3}}],line:97},"24":{loc:{start:{line:98,column:20},end:{line:98,column:93}},type:"binary-expr",locations:[{start:{line:98,column:20},end:{line:98,column:56}},{start:{line:98,column:60},end:{line:98,column:93}}],line:98},"25":{loc:{start:{line:99,column:3},end:{line:103,column:4}},type:"if",locations:[{start:{line:99,column:3},end:{line:103,column:4}},{start:{line:99,column:3},end:{line:103,column:4}}],line:99},"26":{loc:{start:{line:102,column:10},end:{line:102,column:24}},type:"binary-expr",locations:[{start:{line:102,column:10},end:{line:102,column:18}},{start:{line:102,column:22},end:{line:102,column:24}}],line:102},"27":{loc:{start:{line:104,column:9},end:{line:106,column:3}},type:"if",locations:[{start:{line:104,column:9},end:{line:106,column:3}},{start:{line:104,column:9},end:{line:106,column:3}}],line:104},"28":{loc:{start:{line:105,column:15},end:{line:105,column:100}},type:"binary-expr",locations:[{start:{line:105,column:15},end:{line:105,column:50}},{start:{line:105,column:54},end:{line:105,column:88}},{start:{line:105,column:92},end:{line:105,column:100}}],line:105},"29":{loc:{start:{line:110,column:1},end:{line:113,column:2}},type:"if",locations:[{start:{line:110,column:1},end:{line:113,column:2}},{start:{line:110,column:1},end:{line:113,column:2}}],line:110},"30":{loc:{start:{line:110,column:5},end:{line:110,column:46}},type:"binary-expr",locations:[{start:{line:110,column:5},end:{line:110,column:16}},{start:{line:110,column:20},end:{line:110,column:46}}],line:110},"31":{loc:{start:{line:116,column:1},end:{line:121,column:2}},type:"if",locations:[{start:{line:116,column:1},end:{line:121,column:2}},{start:{line:116,column:1},end:{line:121,column:2}}],line:116},"32":{loc:{start:{line:116,column:5},end:{line:116,column:43}},type:"binary-expr",locations:[{start:{line:116,column:5},end:{line:116,column:16}},{start:{line:116,column:20},end:{line:116,column:30}},{start:{line:116,column:34},end:{line:116,column:43}}],line:116},"33":{loc:{start:{line:122,column:1},end:{line:124,column:2}},type:"if",locations:[{start:{line:122,column:1},end:{line:124,column:2}},{start:{line:122,column:1},end:{line:124,column:2}}],line:122},"34":{loc:{start:{line:123,column:8},end:{line:123,column:20}},type:"binary-expr",locations:[{start:{line:123,column:8},end:{line:123,column:14}},{start:{line:123,column:18},end:{line:123,column:20}}],line:123},"35":{loc:{start:{line:125,column:1},end:{line:127,column:2}},type:"if",locations:[{start:{line:125,column:1},end:{line:127,column:2}},{start:{line:125,column:1},end:{line:127,column:2}}],line:125},"36":{loc:{start:{line:125,column:5},end:{line:125,column:58}},type:"binary-expr",locations:[{start:{line:125,column:5},end:{line:125,column:16}},{start:{line:125,column:20},end:{line:125,column:46}},{start:{line:125,column:50},end:{line:125,column:58}}],line:125},"37":{loc:{start:{line:128,column:1},end:{line:137,column:2}},type:"if",locations:[{start:{line:128,column:1},end:{line:137,column:2}},{start:{line:128,column:1},end:{line:137,column:2}}],line:128},"38":{loc:{start:{line:130,column:3},end:{line:135,column:4}},type:"if",locations:[{start:{line:130,column:3},end:{line:135,column:4}},{start:{line:130,column:3},end:{line:135,column:4}}],line:130},"39":{loc:{start:{line:132,column:4},end:{line:134,column:5}},type:"if",locations:[{start:{line:132,column:4},end:{line:134,column:5}},{start:{line:132,column:4},end:{line:134,column:5}}],line:132},"40":{loc:{start:{line:138,column:1},end:{line:143,column:2}},type:"if",locations:[{start:{line:138,column:1},end:{line:143,column:2}},{start:{line:138,column:1},end:{line:143,column:2}}],line:138},"41":{loc:{start:{line:138,column:5},end:{line:138,column:39}},type:"binary-expr",locations:[{start:{line:138,column:5},end:{line:138,column:16}},{start:{line:138,column:20},end:{line:138,column:39}}],line:138},"42":{loc:{start:{line:140,column:2},end:{line:142,column:3}},type:"if",locations:[{start:{line:140,column:2},end:{line:142,column:3}},{start:{line:140,column:2},end:{line:142,column:3}}],line:140},"43":{loc:{start:{line:140,column:6},end:{line:140,column:47}},type:"binary-expr",locations:[{start:{line:140,column:6},end:{line:140,column:14}},{start:{line:140,column:18},end:{line:140,column:47}}],line:140},"44":{loc:{start:{line:144,column:1},end:{line:146,column:2}},type:"if",locations:[{start:{line:144,column:1},end:{line:146,column:2}},{start:{line:144,column:1},end:{line:146,column:2}}],line:144},"45":{loc:{start:{line:144,column:5},end:{line:144,column:35}},type:"binary-expr",locations:[{start:{line:144,column:5},end:{line:144,column:16}},{start:{line:144,column:20},end:{line:144,column:35}}],line:144},"46":{loc:{start:{line:145,column:8},end:{line:145,column:44}},type:"binary-expr",locations:[{start:{line:145,column:8},end:{line:145,column:38}},{start:{line:145,column:42},end:{line:145,column:44}}],line:145},"47":{loc:{start:{line:150,column:1},end:{line:152,column:2}},type:"if",locations:[{start:{line:150,column:1},end:{line:152,column:2}},{start:{line:150,column:1},end:{line:152,column:2}}],line:150},"48":{loc:{start:{line:150,column:5},end:{line:150,column:112}},type:"binary-expr",locations:[{start:{line:150,column:5},end:{line:150,column:16}},{start:{line:150,column:21},end:{line:150,column:30}},{start:{line:150,column:34},end:{line:150,column:58}},{start:{line:150,column:62},end:{line:150,column:81}},{start:{line:150,column:86},end:{line:150,column:112}}],line:150},"49":{loc:{start:{line:154,column:1},end:{line:156,column:2}},type:"if",locations:[{start:{line:154,column:1},end:{line:156,column:2}},{start:{line:154,column:1},end:{line:156,column:2}}],line:154},"50":{loc:{start:{line:154,column:5},end:{line:154,column:47}},type:"binary-expr",locations:[{start:{line:154,column:5},end:{line:154,column:16}},{start:{line:154,column:20},end:{line:154,column:47}}],line:154},"51":{loc:{start:{line:155,column:8},end:{line:155,column:22}},type:"binary-expr",locations:[{start:{line:155,column:8},end:{line:155,column:16}},{start:{line:155,column:20},end:{line:155,column:22}}],line:155},"52":{loc:{start:{line:158,column:1},end:{line:164,column:2}},type:"if",locations:[{start:{line:158,column:1},end:{line:164,column:2}},{start:{line:158,column:1},end:{line:164,column:2}}],line:158},"53":{loc:{start:{line:160,column:3},end:{line:162,column:4}},type:"if",locations:[{start:{line:160,column:3},end:{line:162,column:4}},{start:{line:160,column:3},end:{line:162,column:4}}],line:160},"54":{loc:{start:{line:170,column:1},end:{line:172,column:2}},type:"if",locations:[{start:{line:170,column:1},end:{line:172,column:2}},{start:{line:170,column:1},end:{line:172,column:2}}],line:170},"55":{loc:{start:{line:171,column:8},end:{line:171,column:40}},type:"binary-expr",locations:[{start:{line:171,column:8},end:{line:171,column:16}},{start:{line:171,column:20},end:{line:171,column:34}},{start:{line:171,column:38},end:{line:171,column:40}}],line:171},"56":{loc:{start:{line:176,column:1},end:{line:178,column:2}},type:"if",locations:[{start:{line:176,column:1},end:{line:178,column:2}},{start:{line:176,column:1},end:{line:178,column:2}}],line:176},"57":{loc:{start:{line:195,column:1},end:{line:211,column:2}},type:"if",locations:[{start:{line:195,column:1},end:{line:211,column:2}},{start:{line:195,column:1},end:{line:211,column:2}}],line:195},"58":{loc:{start:{line:199,column:10},end:{line:199,column:49}},type:"cond-expr",locations:[{start:{line:199,column:18},end:{line:199,column:44}},{start:{line:199,column:47},end:{line:199,column:49}}],line:199},"59":{loc:{start:{line:202,column:8},end:{line:211,column:2}},type:"if",locations:[{start:{line:202,column:8},end:{line:211,column:2}},{start:{line:202,column:8},end:{line:211,column:2}}],line:202},"60":{loc:{start:{line:204,column:8},end:{line:211,column:2}},type:"if",locations:[{start:{line:204,column:8},end:{line:211,column:2}},{start:{line:204,column:8},end:{line:211,column:2}}],line:204},"61":{loc:{start:{line:206,column:2},end:{line:208,column:3}},type:"if",locations:[{start:{line:206,column:2},end:{line:208,column:3}},{start:{line:206,column:2},end:{line:208,column:3}}],line:206},"62":{loc:{start:{line:206,column:6},end:{line:206,column:45}},type:"binary-expr",locations:[{start:{line:206,column:6},end:{line:206,column:13}},{start:{line:206,column:17},end:{line:206,column:45}}],line:206},"63":{loc:{start:{line:209,column:8},end:{line:211,column:2}},type:"if",locations:[{start:{line:209,column:8},end:{line:211,column:2}},{start:{line:209,column:8},end:{line:211,column:2}}],line:209},"64":{loc:{start:{line:212,column:1},end:{line:214,column:2}},type:"if",locations:[{start:{line:212,column:1},end:{line:214,column:2}},{start:{line:212,column:1},end:{line:214,column:2}}],line:212},"65":{loc:{start:{line:212,column:5},end:{line:212,column:35}},type:"binary-expr",locations:[{start:{line:212,column:5},end:{line:212,column:16}},{start:{line:212,column:20},end:{line:212,column:35}}],line:212},"66":{loc:{start:{line:213,column:8},end:{line:213,column:44}},type:"binary-expr",locations:[{start:{line:213,column:8},end:{line:213,column:38}},{start:{line:213,column:42},end:{line:213,column:44}}],line:213},"67":{loc:{start:{line:216,column:8},end:{line:216,column:17}},type:"binary-expr",locations:[{start:{line:216,column:8},end:{line:216,column:11}},{start:{line:216,column:15},end:{line:216,column:17}}],line:216},"68":{loc:{start:{line:218,column:1},end:{line:220,column:2}},type:"if",locations:[{start:{line:218,column:1},end:{line:220,column:2}},{start:{line:218,column:1},end:{line:220,column:2}}],line:218}},s:{"0":0,"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0,"79":0,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0,"101":0,"102":0,"103":0,"104":0,"105":0,"106":0,"107":0,"108":0,"109":0,"110":0,"111":0,"112":0,"113":0,"114":0,"115":0,"116":0,"117":0,"118":0,"119":0,"120":0,"121":0,"122":0,"123":0,"124":0,"125":0,"126":0},f:{"0":0,"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0},b:{"0":[0,0],"1":[0,0],"2":[0,0],"3":[0,0],"4":[0,0],"5":[0,0],"6":[0,0],"7":[0,0],"8":[0,0],"9":[0,0],"10":[0,0],"11":[0,0],"12":[0,0],"13":[0,0],"14":[0,0],"15":[0,0],"16":[0,0],"17":[0,0],"18":[0,0],"19":[0,0],"20":[0,0],"21":[0,0],"22":[0,0],"23":[0,0],"24":[0,0],"25":[0,0],"26":[0,0],"27":[0,0],"28":[0,0,0],"29":[0,0],"30":[0,0],"31":[0,0],"32":[0,0,0],"33":[0,0],"34":[0,0],"35":[0,0],"36":[0,0,0],"37":[0,0],"38":[0,0],"39":[0,0],"40":[0,0],"41":[0,0],"42":[0,0],"43":[0,0],"44":[0,0],"45":[0,0],"46":[0,0],"47":[0,0],"48":[0,0,0,0,0],"49":[0,0],"50":[0,0],"51":[0,0],"52":[0,0],"53":[0,0],"54":[0,0],"55":[0,0,0],"56":[0,0],"57":[0,0],"58":[0,0],"59":[0,0],"60":[0,0],"61":[0,0],"62":[0,0],"63":[0,0],"64":[0,0],"65":[0,0],"66":[0,0],"67":[0,0],"68":[0,0]},_coverageSchema:"1a1c01bbd47fc00a2c39e90264f33305004495a9",hash:"33fb1e8c5c5d4b85b7cbe0185f2673ac454be0c8"};var coverage=global[gcv]||(global[gcv]={});if(!coverage[path]||coverage[path].hash!==hash){coverage[path]=coverageData;}var actualCoverage=coverage[path];{// @ts-ignore1306 -1 cov_22i8nvh4cs=function(){return actualCoverage;};}return actualCoverage;}cov_22i8nvh4cs();const constants=(cov_22i8nvh4cs().s[0]++,require('./constants.js'));const atree=(cov_22i8nvh4cs().s[1]++,require('./atree.js'));const query=(cov_22i8nvh4cs().s[2]++,require('./query.js'));cov_22i8nvh4cs().s[3]++;const addSpaces=function(text,el,pseudoSelector){cov_22i8nvh4cs().f[0]++;// https://github.com/w3c/accname/issues/31307 -1 const styles=(cov_22i8nvh4cs().s[4]++,window.getComputedStyle(el,pseudoSelector));const inline=(cov_22i8nvh4cs().s[5]++,styles.display==='inline');cov_22i8nvh4cs().s[6]++;return inline?(cov_22i8nvh4cs().b[0][0]++,text):(cov_22i8nvh4cs().b[0][1]++,` ${text} `);};cov_22i8nvh4cs().s[7]++;const getPseudoContent=function(el,pseudoSelector){cov_22i8nvh4cs().f[1]++;const styles=(cov_22i8nvh4cs().s[8]++,window.getComputedStyle(el,pseudoSelector));let tail=(cov_22i8nvh4cs().s[9]++,styles.getPropertyValue('content').trim());let ret=(cov_22i8nvh4cs().s[10]++,[]);let match;cov_22i8nvh4cs().s[11]++;while(tail.length){cov_22i8nvh4cs().s[12]++;if(match=tail.match(/^"([^"]*)"/)){cov_22i8nvh4cs().b[1][0]++;cov_22i8nvh4cs().s[13]++;ret.push(match[1]);}else{cov_22i8nvh4cs().b[1][1]++;cov_22i8nvh4cs().s[14]++;if(match=tail.match(/^([a-z-]+)\(([^)]*)\)/)){cov_22i8nvh4cs().b[2][0]++;cov_22i8nvh4cs().s[15]++;if(match[1]==='attr'){cov_22i8nvh4cs().b[3][0]++;cov_22i8nvh4cs().s[16]++;ret.push((cov_22i8nvh4cs().b[4][0]++,el.getAttribute(match[2]))||(cov_22i8nvh4cs().b[4][1]++,''));}else{cov_22i8nvh4cs().b[3][1]++;}}else{cov_22i8nvh4cs().b[2][1]++;cov_22i8nvh4cs().s[17]++;if(match=tail.match(/^([a-z-]+)/)){cov_22i8nvh4cs().b[5][0]++;cov_22i8nvh4cs().s[18]++;if((cov_22i8nvh4cs().b[7][0]++,match[1]==='open-quote')||(cov_22i8nvh4cs().b[7][1]++,match[1]==='close-quote')){cov_22i8nvh4cs().b[6][0]++;cov_22i8nvh4cs().s[19]++;ret.push('"');}else{cov_22i8nvh4cs().b[6][1]++;}}else{cov_22i8nvh4cs().b[5][1]++;cov_22i8nvh4cs().s[20]++;if(match=tail.match(/^\//)){cov_22i8nvh4cs().b[8][0]++;cov_22i8nvh4cs().s[21]++;ret=[];}else{cov_22i8nvh4cs().b[8][1]++;cov_22i8nvh4cs().s[22]++;// invalid content, ignore1308 -1 return'';}}}}cov_22i8nvh4cs().s[23]++;tail=tail.slice(match[0].length).trim();}cov_22i8nvh4cs().s[24]++;return addSpaces(ret.join(''),el,pseudoSelector);};cov_22i8nvh4cs().s[25]++;const getContent=function(root,ongoingLabelledBy,visited){cov_22i8nvh4cs().f[2]++;const children=(cov_22i8nvh4cs().s[26]++,atree.getChildNodes(root));let ret=(cov_22i8nvh4cs().s[27]++,'');cov_22i8nvh4cs().s[28]++;for(let i=(cov_22i8nvh4cs().s[29]++,0);i<children.length;i++){const node=(cov_22i8nvh4cs().s[30]++,children[i]);cov_22i8nvh4cs().s[31]++;if(node.nodeType===node.TEXT_NODE){cov_22i8nvh4cs().b[9][0]++;cov_22i8nvh4cs().s[32]++;ret+=node.textContent;}else{cov_22i8nvh4cs().b[9][1]++;cov_22i8nvh4cs().s[33]++;if(node.nodeType===node.ELEMENT_NODE){cov_22i8nvh4cs().b[10][0]++;cov_22i8nvh4cs().s[34]++;if(node.tagName.toLowerCase()==='br'){cov_22i8nvh4cs().b[11][0]++;cov_22i8nvh4cs().s[35]++;ret+='\n';}else{cov_22i8nvh4cs().b[11][1]++;cov_22i8nvh4cs().s[36]++;ret+=getName(node,true,ongoingLabelledBy,visited);}}else{cov_22i8nvh4cs().b[10][1]++;}}}cov_22i8nvh4cs().s[37]++;return ret;};cov_22i8nvh4cs().s[38]++;const allowNameFromContent=function(el){cov_22i8nvh4cs().f[3]++;const role=(cov_22i8nvh4cs().s[39]++,query.getRole(el));cov_22i8nvh4cs().s[40]++;if(role){cov_22i8nvh4cs().b[12][0]++;cov_22i8nvh4cs().s[41]++;return constants.roles[role].nameFromContents;}else{cov_22i8nvh4cs().b[12][1]++;}};cov_22i8nvh4cs().s[42]++;const getName=function(el,recursive,ongoingLabelledBy,visited,directReference){cov_22i8nvh4cs().f[4]++;let ret=(cov_22i8nvh4cs().s[43]++,'');cov_22i8nvh4cs().s[44]++;visited=(cov_22i8nvh4cs().b[13][0]++,visited)||(cov_22i8nvh4cs().b[13][1]++,[]);cov_22i8nvh4cs().s[45]++;if(visited.includes(el)){cov_22i8nvh4cs().b[14][0]++;cov_22i8nvh4cs().s[46]++;if(!directReference){cov_22i8nvh4cs().b[15][0]++;cov_22i8nvh4cs().s[47]++;return'';}else{cov_22i8nvh4cs().b[15][1]++;}}else{cov_22i8nvh4cs().b[14][1]++;cov_22i8nvh4cs().s[48]++;visited.push(el);}// A1309 -1 // handled in atree1310 -1 // B1311 -1 cov_22i8nvh4cs().s[49]++;if((cov_22i8nvh4cs().b[17][0]++,!ongoingLabelledBy)&&(cov_22i8nvh4cs().b[17][1]++,el.matches('[aria-labelledby]'))){cov_22i8nvh4cs().b[16][0]++;const ids=(cov_22i8nvh4cs().s[50]++,el.getAttribute('aria-labelledby').split(/\s+/));const strings=(cov_22i8nvh4cs().s[51]++,ids.map(id=>{cov_22i8nvh4cs().f[5]++;const label=(cov_22i8nvh4cs().s[52]++,document.getElementById(id));cov_22i8nvh4cs().s[53]++;return label?(cov_22i8nvh4cs().b[18][0]++,getName(label,true,true,visited,true)):(cov_22i8nvh4cs().b[18][1]++,'');}));cov_22i8nvh4cs().s[54]++;ret=strings.join(' ');}else{cov_22i8nvh4cs().b[16][1]++;}// E (the current draft has this at this high priority)1312 -1 cov_22i8nvh4cs().s[55]++;if((cov_22i8nvh4cs().b[20][0]++,!ret.trim())&&(cov_22i8nvh4cs().b[20][1]++,recursive)){cov_22i8nvh4cs().b[19][0]++;cov_22i8nvh4cs().s[56]++;if(query.matches(el,'textbox')){cov_22i8nvh4cs().b[21][0]++;cov_22i8nvh4cs().s[57]++;ret=(cov_22i8nvh4cs().b[22][0]++,el.value)||(cov_22i8nvh4cs().b[22][1]++,el.textContent);}else{cov_22i8nvh4cs().b[21][1]++;cov_22i8nvh4cs().s[58]++;if(query.matches(el,'combobox,listbox')){cov_22i8nvh4cs().b[23][0]++;const selected=(cov_22i8nvh4cs().s[59]++,(cov_22i8nvh4cs().b[24][0]++,query.querySelector(el,':selected'))||(cov_22i8nvh4cs().b[24][1]++,query.querySelector(el,'option')));cov_22i8nvh4cs().s[60]++;if(selected){cov_22i8nvh4cs().b[25][0]++;cov_22i8nvh4cs().s[61]++;ret=getName(selected,recursive,ongoingLabelledBy,visited);}else{cov_22i8nvh4cs().b[25][1]++;cov_22i8nvh4cs().s[62]++;ret=(cov_22i8nvh4cs().b[26][0]++,el.value)||(cov_22i8nvh4cs().b[26][1]++,'');}}else{cov_22i8nvh4cs().b[23][1]++;cov_22i8nvh4cs().s[63]++;if(query.matches(el,'range')){cov_22i8nvh4cs().b[27][0]++;cov_22i8nvh4cs().s[64]++;ret=''+((cov_22i8nvh4cs().b[28][0]++,query.getAttribute(el,'valuetext'))||(cov_22i8nvh4cs().b[28][1]++,query.getAttribute(el,'valuenow'))||(cov_22i8nvh4cs().b[28][2]++,el.value));}else{cov_22i8nvh4cs().b[27][1]++;}}}}else{cov_22i8nvh4cs().b[19][1]++;}// C1313 -1 cov_22i8nvh4cs().s[65]++;if((cov_22i8nvh4cs().b[30][0]++,!ret.trim())&&(cov_22i8nvh4cs().b[30][1]++,el.matches('[aria-label]'))){cov_22i8nvh4cs().b[29][0]++;cov_22i8nvh4cs().s[66]++;// FIXME: may skip to 2E1314 -1 ret=el.getAttribute('aria-label');}else{cov_22i8nvh4cs().b[29][1]++;}// D1315 -1 cov_22i8nvh4cs().s[67]++;if((cov_22i8nvh4cs().b[32][0]++,!ret.trim())&&(cov_22i8nvh4cs().b[32][1]++,!recursive)&&(cov_22i8nvh4cs().b[32][2]++,el.labels)){cov_22i8nvh4cs().b[31][0]++;const strings=(cov_22i8nvh4cs().s[68]++,Array.prototype.map.call(el.labels,label=>{cov_22i8nvh4cs().f[6]++;cov_22i8nvh4cs().s[69]++;return getName(label,true,ongoingLabelledBy,visited);}));cov_22i8nvh4cs().s[70]++;ret=strings.join(' ');}else{cov_22i8nvh4cs().b[31][1]++;}cov_22i8nvh4cs().s[71]++;if(!ret.trim()){cov_22i8nvh4cs().b[33][0]++;cov_22i8nvh4cs().s[72]++;ret=(cov_22i8nvh4cs().b[34][0]++,el.alt)||(cov_22i8nvh4cs().b[34][1]++,'');}else{cov_22i8nvh4cs().b[33][1]++;}cov_22i8nvh4cs().s[73]++;if((cov_22i8nvh4cs().b[36][0]++,!ret.trim())&&(cov_22i8nvh4cs().b[36][1]++,el.matches('abbr,acronym'))&&(cov_22i8nvh4cs().b[36][2]++,el.title)){cov_22i8nvh4cs().b[35][0]++;cov_22i8nvh4cs().s[74]++;ret=el.title;}else{cov_22i8nvh4cs().b[35][1]++;}cov_22i8nvh4cs().s[75]++;if(!ret.trim()){cov_22i8nvh4cs().b[37][0]++;cov_22i8nvh4cs().s[76]++;for(const selector in constants.nameFromDescendant){cov_22i8nvh4cs().s[77]++;if(el.matches(selector)){cov_22i8nvh4cs().b[38][0]++;const descendant=(cov_22i8nvh4cs().s[78]++,el.querySelector(constants.nameFromDescendant[selector]));cov_22i8nvh4cs().s[79]++;if(descendant){cov_22i8nvh4cs().b[39][0]++;cov_22i8nvh4cs().s[80]++;ret=getName(descendant,true,ongoingLabelledBy,visited);}else{cov_22i8nvh4cs().b[39][1]++;}}else{cov_22i8nvh4cs().b[38][1]++;}}}else{cov_22i8nvh4cs().b[37][1]++;}cov_22i8nvh4cs().s[81]++;if((cov_22i8nvh4cs().b[41][0]++,!ret.trim())&&(cov_22i8nvh4cs().b[41][1]++,el.matches('svg *'))){cov_22i8nvh4cs().b[40][0]++;const svgTitle=(cov_22i8nvh4cs().s[82]++,el.querySelector('title'));cov_22i8nvh4cs().s[83]++;if((cov_22i8nvh4cs().b[43][0]++,svgTitle)&&(cov_22i8nvh4cs().b[43][1]++,svgTitle.parentElement===el)){cov_22i8nvh4cs().b[42][0]++;cov_22i8nvh4cs().s[84]++;ret=svgTitle.textContent;}else{cov_22i8nvh4cs().b[42][1]++;}}else{cov_22i8nvh4cs().b[40][1]++;}cov_22i8nvh4cs().s[85]++;if((cov_22i8nvh4cs().b[45][0]++,!ret.trim())&&(cov_22i8nvh4cs().b[45][1]++,el.matches('a'))){cov_22i8nvh4cs().b[44][0]++;cov_22i8nvh4cs().s[86]++;ret=(cov_22i8nvh4cs().b[46][0]++,el.getAttribute('xlink:title'))||(cov_22i8nvh4cs().b[46][1]++,'');}else{cov_22i8nvh4cs().b[44][1]++;}// F1316 -1 // FIXME: menu is not mentioned in the spec1317 -1 cov_22i8nvh4cs().s[87]++;if((cov_22i8nvh4cs().b[48][0]++,!ret.trim())&&((cov_22i8nvh4cs().b[48][1]++,recursive)||(cov_22i8nvh4cs().b[48][2]++,allowNameFromContent(el))||(cov_22i8nvh4cs().b[48][3]++,el.closest('label')))&&(cov_22i8nvh4cs().b[48][4]++,!query.matches(el,'menu'))){cov_22i8nvh4cs().b[47][0]++;cov_22i8nvh4cs().s[88]++;ret=getContent(el,ongoingLabelledBy,visited);}else{cov_22i8nvh4cs().b[47][1]++;}cov_22i8nvh4cs().s[89]++;if((cov_22i8nvh4cs().b[50][0]++,!ret.trim())&&(cov_22i8nvh4cs().b[50][1]++,query.matches(el,'button'))){cov_22i8nvh4cs().b[49][0]++;cov_22i8nvh4cs().s[90]++;ret=(cov_22i8nvh4cs().b[51][0]++,el.value)||(cov_22i8nvh4cs().b[51][1]++,'');}else{cov_22i8nvh4cs().b[49][1]++;}cov_22i8nvh4cs().s[91]++;if(!ret.trim()){cov_22i8nvh4cs().b[52][0]++;cov_22i8nvh4cs().s[92]++;for(const selector in constants.nameDefaults){cov_22i8nvh4cs().s[93]++;if(el.matches(selector)){cov_22i8nvh4cs().b[53][0]++;cov_22i8nvh4cs().s[94]++;ret=constants.nameDefaults[selector];}else{cov_22i8nvh4cs().b[53][1]++;}}}else{cov_22i8nvh4cs().b[52][1]++;}// G/H1318 -1 // handled in getContent1319 -1 // I1320 -1 cov_22i8nvh4cs().s[95]++;if(!ret.trim()){cov_22i8nvh4cs().b[54][0]++;cov_22i8nvh4cs().s[96]++;ret=(cov_22i8nvh4cs().b[55][0]++,el.title)||(cov_22i8nvh4cs().b[55][1]++,el.placeholder)||(cov_22i8nvh4cs().b[55][2]++,'');}else{cov_22i8nvh4cs().b[54][1]++;}// FIXME: not exactly sure about this, but it reduces the number of failing1321 -1 // WPT tests. Whitespace is hard.1322 -1 cov_22i8nvh4cs().s[97]++;if(!ret.trim()){cov_22i8nvh4cs().b[56][0]++;cov_22i8nvh4cs().s[98]++;ret=' ';}else{cov_22i8nvh4cs().b[56][1]++;}const before=(cov_22i8nvh4cs().s[99]++,getPseudoContent(el,':before'));const after=(cov_22i8nvh4cs().s[100]++,getPseudoContent(el,':after'));cov_22i8nvh4cs().s[101]++;return addSpaces(before+ret+after,el);};cov_22i8nvh4cs().s[102]++;const getNameTrimmed=function(el){cov_22i8nvh4cs().f[7]++;cov_22i8nvh4cs().s[103]++;return getName(el).replace(/[ \n\r\t\f]+/g,' ').replace(/^ /,'').replace(/ $/,'');};cov_22i8nvh4cs().s[104]++;const getDescription=function(el){cov_22i8nvh4cs().f[8]++;let ret=(cov_22i8nvh4cs().s[105]++,'');cov_22i8nvh4cs().s[106]++;if(el.matches('[aria-describedby]')){cov_22i8nvh4cs().b[57][0]++;const ids=(cov_22i8nvh4cs().s[107]++,el.getAttribute('aria-describedby').split(/\s+/));const strings=(cov_22i8nvh4cs().s[108]++,ids.map(id=>{cov_22i8nvh4cs().f[9]++;const label=(cov_22i8nvh4cs().s[109]++,document.getElementById(id));cov_22i8nvh4cs().s[110]++;return label?(cov_22i8nvh4cs().b[58][0]++,getName(label,true,true)):(cov_22i8nvh4cs().b[58][1]++,'');}));cov_22i8nvh4cs().s[111]++;ret=strings.join(' ');}else{cov_22i8nvh4cs().b[57][1]++;cov_22i8nvh4cs().s[112]++;if(el.matches('[aria-description]')){cov_22i8nvh4cs().b[59][0]++;cov_22i8nvh4cs().s[113]++;ret=el.getAttribute('aria-description');}else{cov_22i8nvh4cs().b[59][1]++;cov_22i8nvh4cs().s[114]++;if(el.matches('svg *')){cov_22i8nvh4cs().b[60][0]++;const svgDesc=(cov_22i8nvh4cs().s[115]++,el.querySelector('desc'));cov_22i8nvh4cs().s[116]++;if((cov_22i8nvh4cs().b[62][0]++,svgDesc)&&(cov_22i8nvh4cs().b[62][1]++,svgDesc.parentElement===el)){cov_22i8nvh4cs().b[61][0]++;cov_22i8nvh4cs().s[117]++;ret=svgDesc.textContent;}else{cov_22i8nvh4cs().b[61][1]++;}}else{cov_22i8nvh4cs().b[60][1]++;cov_22i8nvh4cs().s[118]++;if(el.title){cov_22i8nvh4cs().b[63][0]++;cov_22i8nvh4cs().s[119]++;ret=el.title;}else{cov_22i8nvh4cs().b[63][1]++;}}}}cov_22i8nvh4cs().s[120]++;if((cov_22i8nvh4cs().b[65][0]++,!ret.trim())&&(cov_22i8nvh4cs().b[65][1]++,el.matches('a'))){cov_22i8nvh4cs().b[64][0]++;cov_22i8nvh4cs().s[121]++;ret=(cov_22i8nvh4cs().b[66][0]++,el.getAttribute('xlink:title'))||(cov_22i8nvh4cs().b[66][1]++,'');}else{cov_22i8nvh4cs().b[64][1]++;}cov_22i8nvh4cs().s[122]++;ret=((cov_22i8nvh4cs().b[67][0]++,ret)||(cov_22i8nvh4cs().b[67][1]++,'')).trim().replace(/\s+/g,' ');cov_22i8nvh4cs().s[123]++;if(ret===getNameTrimmed(el)){cov_22i8nvh4cs().b[68][0]++;cov_22i8nvh4cs().s[124]++;ret='';}else{cov_22i8nvh4cs().b[68][1]++;}cov_22i8nvh4cs().s[125]++;return ret;};cov_22i8nvh4cs().s[126]++;module.exports={getName:getNameTrimmed,getDescription:getDescription};1323 -11324 -11325 -1 },{"./atree.js":5,"./constants.js":7,"./query.js":9}],9:[function(require,module,exports){1326 -1 const attrs = require('./attrs.js');1327 -1 const atree = require('./atree.js');1328 -11329 -11330 -1 const matches = function(el, selector) {1331 -1 if (selector.substr(0, 1) === ':') {1332 -1 const attr = selector.substr(1);1333 -1 return attrs.getAttribute(el, attr);1334 -1 } else if (selector.substr(0, 1) === '[') {1335 -1 const match = /\[([a-z]+)="(.*)"\]/.exec(selector);1336 -1 const actual = attrs.getAttribute(el, match[1]);1337 -1 const rawValue = match[2];1338 -1 return actual.toString() === rawValue;1339 -1 } else {1340 -1 return attrs.hasRole(el, selector.split(','));1341 -1 }1342 -1 };1343 -11344 -1 const _querySelector = function(all) {1345 -1 return function(root, selector) {1346 -1 const results = [];1347 -1 try {1348 -1 atree.walk(root, node => {1349 -1 if (node.nodeType === node.ELEMENT_NODE) {1350 -1 // FIXME: skip hidden elements1351 -1 if (matches(node, selector)) {1352 -1 results.push(node);1353 -1 if (!all) {1354 -1 throw 'StopIteration';1355 -1 }1356 -1 }1357 -1 }1358 -1 });1359 -1 } catch (e) {1360 -1 if (e !== 'StopIteration') {1361 -1 throw e;1362 -1 }1363 -1 }1364 -1 return all ? results : results[0];1365 -1 };1366 -1 };1367 -11368 -1 const closest = function(el, selector) {1369 -1 return atree.searchUp(el, candidate => {1370 -1 if (candidate.nodeType === candidate.ELEMENT_NODE) {1371 -1 return matches(candidate, selector);1372 -1 }1373 -1 });1374 -1 };1375 -11376 -1 module.exports = {1377 -1 getRole: el => attrs.getRole(el),1378 -1 getAttribute: attrs.getAttribute,1379 -1 matches: matches,1380 -1 querySelector: _querySelector(),1381 -1 querySelectorAll: _querySelector(true),1382 -1 closest: closest,1383 -1 };1384 -11385 -1 },{"./atree.js":5,"./attrs.js":6}],10:[function(require,module,exports){1386 -1 /*@license1387 -1 CalcNames: The AccName Computation Prototype, compute the Name and Description property values for a DOM node1388 -1 Returns an object with 'name' and 'desc' properties.1389 -1 Functionality mirrors the steps within the W3C Accessible Name and Description computation algorithm.1390 -1 https://w3c.github.io/accname/1391 -1 Author: Bryan Garaventa1392 -1 https://github.com/whatsock/w3c-alternative-text-computation1393 -1 Distributed under the terms of the Open Source Initiative OSI - MIT License1394 -1 */1395 -11396 -1 (function () {1397 -1 var nameSpace = window.AccNamePrototypeNameSpace || window;1398 -1 if (nameSpace && typeof nameSpace === "string" && nameSpace.length) {1399 -1 window[nameSpace] = {};1400 -1 nameSpace = window[nameSpace];1401 -1 }1402 -1 nameSpace.getAccNameVersion = "2.62";1403 -1 // AccName Computation Prototype1404 -1 nameSpace.getAccName = nameSpace.calcNames = function (1405 -1 node,1406 -1 fnc,1407 -1 preventVisualARIASelfCSSRef,1408 -1 overrides,1409 -1 ) {1410 -1 overrides = overrides || {};1411 -1 var docO = overrides.document || document;1412 -1 var props = { name: "", desc: "", error: "" };1413 -1 var nameFromPlaceholder = false;1414 -1 var nameFromUserAgent = false;1415 -1 try {1416 -1 if (!node || node.nodeType !== 1) {1417 -1 return props;1418 -1 }1419 -1 var rootNode = node;1420 -1 var rootRole = trim(node.getAttribute("role") || "");1421 -1 // Track nodes to prevent duplicate node reference parsing.1422 -1 // Separating Name and Description to prevent duplicate node references from suppressing one or the other from being fully computed.1423 -1 var nodes = {1424 -1 name: [],1425 -1 desc: [],1426 -1 };1427 -1 // Track aria-owns references to prevent duplicate parsing.1428 -1 var owns = [];1429 -11430 -1 // Recursively process a DOM node to compute an accessible name in accordance with the spec1431 -1 var walk = function (1432 -1 refNode,1433 -1 stop,1434 -1 skip,1435 -1 nodesToIgnoreValues,1436 -1 skipAbort,1437 -1 ownedBy,1438 -1 skipTo,1439 -1 ) {1440 -1 skipTo = skipTo || {};1441 -1 skipTo.tag = skipTo.tag || false;1442 -1 skipTo.role = skipTo.role || false;1443 -1 skipTo.go = skipTo.go || false;1444 -1 var fullResult = {1445 -1 name: "",1446 -1 title: "",1447 -1 };1448 -1 var hasLabel = false;1449 -11450 -1 /*1451 -1 ARIA Role Exception Rule Set 1.11452 -1 The following Role Exception Rule Set is based on the following ARIA Working Group discussion involving all relevant browser venders.1453 -1 https://lists.w3.org/Archives/Public/public-aria/2017Jun/0057.html1454 -1 Plus roles extended for the Role Parity project.1455 -1 */1456 -1 var isException = function (node, refNode) {1457 -1 if (1458 -1 !refNode ||1459 -1 !node ||1460 -1 refNode.nodeType !== 1 ||1461 -1 node.nodeType !== 11462 -1 ) {1463 -1 return false;1464 -1 }1465 -11466 -1 var role = getRole(node);1467 -1 var tag = node.nodeName.toLowerCase();1468 -11469 -1 var inList = function (node, list) {1470 -1 return (1471 -1 (role && list.roles.indexOf(role) >= 0) ||1472 -1 (!role && list.tags.indexOf(tag) >= 0)1473 -1 );1474 -1 };1475 -11476 -1 // The list3 overrides must be checked first.1477 -1 if (inList(node, list3)) {1478 -1 if (1479 -1 node === refNode &&1480 -1 !(node.id && ownedBy[node.id] && ownedBy[node.id].node)1481 -1 ) {1482 -1 return !isFocusable(node);1483 -1 } else {1484 -1 // Note: the inParent checker needs to be present to allow for embedded roles matching list3 when the referenced parent is referenced using aria-labelledby, aria-describedby, or aria-owns.1485 -1 return !(1486 -1 (inParent(node, ownedBy.top) &&1487 -1 node.nodeName.toLowerCase() !== "select") ||1488 -1 inList(refNode, list1)1489 -1 );1490 -1 }1491 -1 }1492 -1 // Otherwise process list2 to identify roles to ignore processing name from content.1493 -1 else {1494 -1 return !!(1495 -1 (inList(node, list2) ||1496 -1 (node === rootNode && !inList(node, list1))) &&1497 -1 !(1498 -1 !role &&1499 -1 ["section"].indexOf(tag) !== -1 &&1500 -1 !(1501 -1 node.getAttribute("aria-labelledby") ||1502 -1 node.getAttribute("aria-label")1503 -1 )1504 -1 ) &&1505 -1 !skipTo.go1506 -1 );1507 -1 }1508 -1 };1509 -11510 -1 var inParent = function (node, parent) {1511 -1 var trackNodes = [];1512 -1 while (node) {1513 -1 if (1514 -1 node.id &&1515 -1 ownedBy[node.id] &&1516 -1 ownedBy[node.id].node &&1517 -1 trackNodes.indexOf(node) === -11518 -1 ) {1519 -1 trackNodes.push(node);1520 -1 node = ownedBy[node.id].node;1521 -1 } else {1522 -1 node = node.parentNode;1523 -1 }1524 -1 if (node && node === parent) {1525 -1 return true;1526 -1 } else if (!node || node === ownedBy.top || node === docO.body) {1527 -1 return false;1528 -1 }1529 -1 }1530 -1 return false;1531 -1 };1532 -11533 -1 // Placeholder for storing CSS before and after pseudo element text values for the top level node1534 -1 var cssOP = {1535 -1 before: "",1536 -1 after: "",1537 -1 };1538 -11539 -1 if (1540 -1 !skipTo.tag &&1541 -1 !skipTo.role &&1542 -1 nodes[!ownedBy.computingDesc ? "name" : "desc"].indexOf(refNode) ===1543 -1 -11544 -1 ) {1545 -1 // Store the before and after pseudo element 'content' values for the top level DOM node1546 -1 // Note: If the pseudo element includes block level styling, a space will be added, otherwise inline is asumed and no spacing is added.1547 -1 cssOP = getCSSText(refNode, null);1548 -11549 -1 // Enabled in Visual ARIA to prevent self referencing by Visual ARIA tooltips1550 -1 if (preventVisualARIASelfCSSRef) {1551 -1 if (1552 -1 cssOP.before.indexOf(" [ARIA] ") !== -1 ||1553 -1 cssOP.before.indexOf(" aria-") !== -1 ||1554 -1 cssOP.before.indexOf(" accName: ") !== -11555 -1 )1556 -1 cssOP.before = "";1557 -1 if (1558 -1 cssOP.after.indexOf(" [ARIA] ") !== -1 ||1559 -1 cssOP.after.indexOf(" aria-") !== -1 ||1560 -1 cssOP.after.indexOf(" accDescription: ") !== -11561 -1 )1562 -1 cssOP.after = "";1563 -1 }1564 -1 }1565 -11566 -1 // Recursively apply the same naming computation to all nodes within the referenced structure1567 -1 var walkDOM = function (node, fn, refNode) {1568 -1 var res = {1569 -1 name: "",1570 -1 title: "",1571 -1 };1572 -1 if (!node) {1573 -1 return res;1574 -1 }1575 -1 var nodeIsBlock = !!(1576 -1 node &&1577 -1 node.nodeType === 1 &&1578 -1 isBlockLevelElement(node)1579 -1 );1580 -1 var currentNode = node;1581 -1 var fResult = fn(node) || {};1582 -1 if (fResult.name && fResult.name.length) {1583 -1 res.name += fResult.name;1584 -1 }1585 -1 if (!fResult.skip && !isException(node, ownedBy.top)) {1586 -1 if (skipTo.go) skipTo.go = false;1587 -1 node = node.firstChild;1588 -1 while (node) {1589 -1 res.name += walkDOM(node, fn, refNode).name;1590 -1 node = node.nextSibling;1591 -1 }1592 -1 }1593 -1 res.name += fResult.owns || "";1594 -1 if (1595 -1 rootNode === currentNode &&1596 -1 refNode === currentNode &&1597 -1 !trim(res.name) &&1598 -1 trim(fResult.title)1599 -1 ) {1600 -1 res.name = addSpacing(fResult.title);1601 -1 } else if (1602 -1 rootNode === currentNode &&1603 -1 refNode === currentNode &&1604 -1 trim(fResult.title)1605 -1 ) {1606 -1 res.title = addSpacing(fResult.title);1607 -1 }1608 -1 if (1609 -1 rootNode === currentNode &&1610 -1 refNode === currentNode &&1611 -1 trim(fResult.desc)1612 -1 ) {1613 -1 res.title = addSpacing(fResult.desc);1614 -1 }1615 -1 if (1616 -1 rootNode === currentNode &&1617 -1 refNode === currentNode &&1618 -1 trim(fResult.placeholder) &&1619 -1 !trim(res.name)1620 -1 ) {1621 -1 res.name = addSpacing(fResult.placeholder);1622 -1 nameFromPlaceholder = true;1623 -1 } else if (1624 -1 rootNode === currentNode &&1625 -1 refNode === currentNode &&1626 -1 trim(fResult.placeholder) &&1627 -1 !trim(res.title)1628 -1 ) {1629 -1 res.title = addSpacing(fResult.placeholder);1630 -1 }1631 -1 if (nodeIsBlock || fResult.isWidget) {1632 -1 res.name = addSpacing(res.name);1633 -1 }1634 -1 return res;1635 -1 };1636 -11637 -1 fullResult = walkDOM(1638 -1 refNode,1639 -1 function (node) {1640 -1 var i = 0;1641 -1 var element = null;1642 -1 var ids = [];1643 -1 var parts = [];1644 -1 var result = {1645 -1 name: "",1646 -1 title: "",1647 -1 owns: "",1648 -1 skip: false,1649 -1 };1650 -1 var isEmbeddedNode = !!(1651 -1 node &&1652 -1 node.nodeType === 1 &&1653 -1 nodesToIgnoreValues &&1654 -1 nodesToIgnoreValues.length &&1655 -1 nodesToIgnoreValues.indexOf(node) !== -1 &&1656 -1 node === rootNode &&1657 -1 node !== refNode1658 -1 );1659 -1 var hLabel = false;1660 -11661 -1 if (1662 -1 (skip || !node || isHidden(node, ownedBy.top)) &&1663 -1 !skipAbort &&1664 -1 !isEmbeddedNode1665 -1 ) {1666 -1 // Abort if algorithm step is already completed, or if node is a hidden child of refNode, or skip abort if aria-labelledby self references same node.1667 -1 return result;1668 -1 }1669 -11670 -1 if (1671 -1 !skipTo.tag &&1672 -1 !skipTo.role &&1673 -1 nodes[!ownedBy.computingDesc ? "name" : "desc"].indexOf(node) ===1674 -1 -11675 -1 ) {1676 -1 nodes[!ownedBy.computingDesc ? "name" : "desc"].push(node);1677 -1 } else {1678 -1 // Abort if this node has already been processed.1679 -1 return result;1680 -1 }1681 -11682 -1 // Store name for the current node.1683 -1 var name = "";1684 -1 // Store name from aria-owns references if detected.1685 -1 var ariaO = "";1686 -1 // Placeholder for storing CSS before and after pseudo element text values for the current node container element1687 -1 var cssO = {1688 -1 before: "",1689 -1 after: "",1690 -1 };1691 -11692 -1 var parent = refNode === node ? node : node.parentNode;1693 -1 if (1694 -1 !skipTo.tag &&1695 -1 !skipTo.role &&1696 -1 nodes[!ownedBy.computingDesc ? "name" : "desc"].indexOf(1697 -1 parent,1698 -1 ) === -11699 -1 ) {1700 -1 nodes[!ownedBy.computingDesc ? "name" : "desc"].push(parent);1701 -1 // Store the before and after pseudo element 'content' values for the current node container element1702 -1 // Note: If the pseudo element includes block level styling, a space will be added, otherwise inline is asumed and no spacing is added.1703 -1 cssO = getCSSText(parent, refNode);1704 -11705 -1 // Enabled in Visual ARIA to prevent self referencing by Visual ARIA tooltips1706 -1 if (preventVisualARIASelfCSSRef) {1707 -1 if (1708 -1 cssO.before.indexOf(" [ARIA] ") !== -1 ||1709 -1 cssO.before.indexOf(" aria-") !== -1 ||1710 -1 cssO.before.indexOf(" accName: ") !== -11711 -1 )1712 -1 cssO.before = "";1713 -1 if (1714 -1 cssO.after.indexOf(" [ARIA] ") !== -1 ||1715 -1 cssO.after.indexOf(" aria-") !== -1 ||1716 -1 cssO.after.indexOf(" accDescription: ") !== -11717 -1 )1718 -1 cssO.after = "";1719 -1 }1720 -1 }1721 -11722 -1 // Process standard DOM element node1723 -1 if (node.nodeType === 1) {1724 -1 var nTag = node.nodeName.toLowerCase();1725 -1 var nRole = getRole(node);1726 -1 var aLabelledby =1727 -1 (!skipTo.tag &&1728 -1 !skipTo.role &&1729 -1 node.getAttribute("aria-labelledby")) ||1730 -1 "";1731 -1 var aDescribedby =1732 -1 (!skipTo.tag &&1733 -1 !skipTo.role &&1734 -1 node.getAttribute("aria-describedby")) ||1735 -1 "";1736 -1 var aDescription =1737 -1 !skipTo.tag &&1738 -1 !skipTo.role &&1739 -1 node.getAttribute("aria-description");1740 -1 var aLabel =1741 -1 (!skipTo.tag &&1742 -1 !skipTo.role &&1743 -1 node.getAttribute("aria-label")) ||1744 -1 "";1745 -1 var nTitle =1746 -1 (!skipTo.tag && !skipTo.role && node.getAttribute("title")) ||1747 -1 "";1748 -11749 -1 // Added to prevent name on generic elements.1750 -1 // https://www.w3.org/TR/wai-aria-1.2/#generic1751 -1 var isGeneric =1752 -1 node === rootNode &&1753 -1 !nRole &&1754 -1 genericElements.indexOf(nTag) !== -1;1755 -1 if (isGeneric) {1756 -1 // Abort since an implicitly generic rootNode cannot have a name1757 -1 return result;1758 -1 }1759 -11760 -1 // Added to prevent name on roles that do not support a name.1761 -1 // https://www.w3.org/TR/wai-aria-1.2/#namefromprohibited1762 -1 var isProhibited =1763 -1 node === rootNode &&1764 -1 (nameProhibitedRoles.indexOf(nRole) !== -1 ||1765 -1 (!nRole && nameProhibitedElements.indexOf(nTag) !== -1));1766 -1 if (isProhibited) {1767 -1 return result;1768 -1 }1769 -11770 -1 var isNativeFormField = nativeFormFields.indexOf(nTag) !== -1;1771 -1 var isNativeButton = ["input"].indexOf(nTag) !== -1;1772 -1 var isRangeWidgetRole = rangeWidgetRoles.indexOf(nRole) !== -1;1773 -1 var isEditWidgetRole = editWidgetRoles.indexOf(nRole) !== -1;1774 -1 var isSelectWidgetRole = selectWidgetRoles.indexOf(nRole) !== -1;1775 -1 var isSimulatedFormField =1776 -1 isRangeWidgetRole ||1777 -1 isEditWidgetRole ||1778 -1 isSelectWidgetRole ||1779 -1 nRole === "combobox";1780 -1 var isWidgetRole =1781 -1 (isSimulatedFormField ||1782 -1 otherWidgetRoles.indexOf(nRole) !== -1) &&1783 -1 nRole !== "link";1784 -1 result.isWidget = isNativeFormField || isWidgetRole;1785 -11786 -1 var hasName = false;1787 -1 var hasDesc = false;1788 -1 var aOwns = node.getAttribute("aria-owns") || "";1789 -1 var isSeparatChildFormField = !!(1790 -1 !skipTo.tag &&1791 -1 !skipTo.role &&1792 -1 !isEmbeddedNode &&1793 -1 ((node !== refNode &&1794 -1 (isNativeFormField || isSimulatedFormField)) ||1795 -1 (node.id &&1796 -1 ownedBy[node.id] &&1797 -1 ownedBy[node.id].target &&1798 -1 ownedBy[node.id].target === node))1799 -1 );1800 -11801 -1 // Check for non-empty value of aria-labelledby on current node, follow each ID ref, then stop and process no deeper.1802 -1 if (!stop && !skipTo.tag && !skipTo.role && aLabelledby) {1803 -1 ids = aLabelledby.split(/\s+/);1804 -1 parts = [];1805 -1 for (i = 0; i < ids.length; i++) {1806 -1 element = docO.getElementById(ids[i]);1807 -1 // Also prevent the current form field from having its value included in the naming computation if nested as a child of label1808 -1 parts.push(1809 -1 walk(element, true, skip, [node], element === refNode, {1810 -1 ref: ownedBy,1811 -1 top: element,1812 -1 }).name,1813 -1 );1814 -1 }1815 -1 // Check for blank value, since whitespace chars alone are not valid as a name1816 -1 name = trim(parts.join(" "));1817 -11818 -1 if (trim(name)) {1819 -1 hasName = true;1820 -1 hLabel = true;1821 -1 hasLabel = true;1822 -1 // Abort further recursion if name is valid.1823 -1 result.skip = true;1824 -1 }1825 -1 }1826 -11827 -1 // Check for non-empty value of aria-describedby/description if current node equals reference node, follow each ID ref, then stop and process no deeper.1828 -1 if (1829 -1 !stop &&1830 -1 node === refNode &&1831 -1 !skipTo.tag &&1832 -1 !skipTo.role &&1833 -1 (aDescribedby || aDescription)1834 -1 ) {1835 -1 if (aDescribedby) {1836 -1 var desc;1837 -1 ids = aDescribedby.split(/\s+/);1838 -1 parts = [];1839 -1 for (i = 0; i < ids.length; i++) {1840 -1 element = docO.getElementById(ids[i]);1841 -1 // Also prevent the current form field from having its value included in the naming computation if nested as a child of label1842 -1 parts.push(1843 -1 walk(element, true, false, [node], false, {1844 -1 ref: ownedBy,1845 -1 top: element,1846 -1 computingDesc: true,1847 -1 }).name,1848 -1 );1849 -1 }1850 -1 // Check for blank value, since whitespace chars alone are not valid as a name1851 -1 desc = trim(parts.join(" "));1852 -1 } else {1853 -1 desc = trim(aDescription);1854 -1 }1855 -1 if (trim(desc)) {1856 -1 result.desc = desc;1857 -1 hasDesc = true;1858 -1 }1859 -1 }1860 -11861 -1 // Otherwise, if current node has a non-empty aria-label then set as name and process no deeper within the branch.1862 -1 if (1863 -1 !skipTo.tag &&1864 -1 !skipTo.role &&1865 -1 !hasName &&1866 -1 trim(aLabel) &&1867 -1 !isSeparatChildFormField1868 -1 ) {1869 -1 name = aLabel;1870 -11871 -1 // Check for blank value, since whitespace chars alone are not valid as a name1872 -1 if (trim(name)) {1873 -1 hasName = true;1874 -1 hLabel = true;1875 -1 if (node === refNode) {1876 -1 // If name is non-empty and both the current and refObject nodes match, then don't process any deeper within the branch.1877 -1 skip = true;1878 -1 hasLabel = true;1879 -1 }1880 -1 }1881 -1 }1882 -11883 -1 var rolePresentation =1884 -1 !skipTo.tag &&1885 -1 !skipTo.role &&1886 -1 !hasName &&1887 -1 nTag !== "iframe" &&1888 -1 nRole &&1889 -1 presentationRoles.indexOf(nRole) !== -1 &&1890 -1 !isFocusable(node) &&1891 -1 !hasGlobalAttr(node);1892 -11893 -1 // Otherwise, if the current node is not a nested widget control within the parent ref obj, but is instead a native markup element that includes a host-defined labelling mechanism, then set the name and description accordingly if present.1894 -1 if (!isSeparatChildFormField) {1895 -1 // Otherwise, if name is still empty and the current node matches the ref node and is a standard form field with a non-empty associated label element, process label with same naming computation algorithm.1896 -1 if (1897 -1 !skipTo.tag &&1898 -1 !skipTo.role &&1899 -1 !hasName &&1900 -1 node === refNode &&1901 -1 isNativeFormField1902 -1 ) {1903 -1 // Logic modified to match issue1904 -1 // https://github.com/WhatSock/w3c-alternative-text-computation/issues/12 */1905 -1 var labels = docO.querySelectorAll("label");1906 -1 var lblName = "";1907 -1 var implicitLabel = getParent(node, "label") || false;1908 -11909 -1 for (i = 0; i < labels.length; i++) {1910 -1 if (1911 -1 ((labels[i] === implicitLabel &&1912 -1 typeof implicitLabel.getAttribute("for") !==1913 -1 "string") ||1914 -1 labels[i].getAttribute("for") === node.id) &&1915 -1 !isParentHidden(labels[i], docO.body, true)1916 -1 ) {1917 -1 lblName += addSpacing(1918 -1 walk(labels[i], true, skip, [node], false, {1919 -1 ref: ownedBy,1920 -1 top: labels[i],1921 -1 }).name,1922 -1 );1923 -1 }1924 -1 }1925 -11926 -1 name = lblName;1927 -11928 -1 if (trim(name)) {1929 -1 hasName = true;1930 -1 }1931 -1 }1932 -11933 -1 // Process native form field buttons in accordance with the HTML AAM1934 -1 // https://w3c.github.io/html-aam/#accessible-name-and-description-computation1935 -1 var btnType =1936 -1 (!skipTo.tag &&1937 -1 !skipTo.role &&1938 -1 isNativeButton &&1939 -1 (node.getAttribute("type") || "").toLowerCase()) ||1940 -1 false;1941 -1 var btnValue =1942 -1 (!skipTo.tag &&1943 -1 !skipTo.role &&1944 -1 btnType &&1945 -1 trim(node.getAttribute("value"))) ||1946 -1 false;1947 -11948 -1 var nAlt =1949 -1 rolePresentation && nTag === "img"1950 -1 ? ""1951 -1 : trim(node.alt || node.getAttribute("alt"));1952 -11953 -1 // Otherwise, if name is still empty and current node is a standard non-presentational img or image button with a non-empty alt or title attribute, set alt or title attribute value as the accessible name.1954 -1 if (1955 -1 !skipTo.tag &&1956 -1 !skipTo.role &&1957 -1 !hasName &&1958 -1 !rolePresentation &&1959 -1 (nRole === "img" || nTag === "img" || btnType === "image") &&1960 -1 (nAlt || trim(nTitle))1961 -1 ) {1962 -1 // Check for blank value, since whitespace chars alone are not valid as a name1963 -1 name = trim(nAlt) || trim(nTitle);1964 -1 if (trim(name)) {1965 -1 hasName = true;1966 -1 }1967 -1 }1968 -11969 -1 // Process native HTML area tags to use alt as name when not explicitly set using aria-labelledby or aria-label.1970 -1 if (1971 -1 !skipTo.tag &&1972 -1 !skipTo.role &&1973 -1 !hasName &&1974 -1 !rolePresentation &&1975 -1 nTag === "area" &&1976 -1 nAlt1977 -1 ) {1978 -1 // Check for blank value, since whitespace chars alone are not valid as a name1979 -1 name = trim(nAlt);1980 -1 if (trim(name)) {1981 -1 hasName = true;1982 -1 }1983 -1 }1984 -11985 -1 // Process native HTML optgroup tags to use label as name when not explicitly set using aria-labelledby or aria-label.1986 -1 if (nTag === "optgroup") {1987 -1 if (1988 -1 !skipTo.tag &&1989 -1 !skipTo.role &&1990 -1 !hasName &&1991 -1 !rolePresentation &&1992 -1 node.getAttribute("label")1993 -1 ) {1994 -1 // Check for blank value, since whitespace chars alone are not valid as a name1995 -1 name = trim(node.getAttribute("label"));1996 -1 if (trim(name)) {1997 -1 hasName = true;1998 -1 }1999 -1 }2000 -1 result.skip = true;2001 -1 }2002 -12003 -1 // Process the accessible names for native HTML buttons2004 -1 if (2005 -1 !skipTo.tag &&2006 -1 !skipTo.role &&2007 -1 !hasName &&2008 -1 node === refNode &&2009 -1 btnType &&2010 -1 ["button", "submit", "reset"].indexOf(btnType) !== -12011 -1 ) {2012 -1 if (btnValue) {2013 -1 name = btnValue;2014 -1 } else {2015 -1 switch (btnType) {2016 -1 case "submit":2017 -1 name = "submit";2018 -1 break;2019 -1 case "reset":2020 -1 name = "reset";2021 -1 break;2022 -1 default:2023 -1 name = "";2024 -1 }2025 -1 }2026 -1 if (trim(name)) {2027 -1 hasName = true;2028 -1 }2029 -1 }2030 -12031 -1 if (2032 -1 !skipTo.tag &&2033 -1 !skipTo.role &&2034 -1 hasName &&2035 -1 node === refNode &&2036 -1 btnType &&2037 -1 ["button", "submit", "reset"].indexOf(btnType) !== -1 &&2038 -1 btnValue &&2039 -1 btnValue !== name &&2040 -1 !result.desc2041 -1 ) {2042 -1 result.desc = btnValue;2043 -1 hasDesc = true;2044 -1 }2045 -12046 -1 // Process the accessible names for native HTML image buttons2047 -1 if (2048 -1 !skipTo.tag &&2049 -1 !skipTo.role &&2050 -1 !hasName &&2051 -1 node === refNode &&2052 -1 btnType &&2053 -1 btnType === "image"2054 -1 ) {2055 -1 name = "Submit Query";2056 -1 hasName = true;2057 -1 nameFromUserAgent = true;2058 -1 }2059 -12060 -1 var isFieldset =2061 -1 !skipTo.tag &&2062 -1 !skipTo.role &&2063 -1 !hasName &&2064 -1 node === rootNode &&2065 -1 (nRole === "group" ||2066 -1 nRole === "radiogroup" ||2067 -1 (!nRole && nTag === "fieldset"));2068 -12069 -1 // Otherwise, if name is still empty and the current node matches the root node and is a standard fieldset element with a non-empty associated legend element as the first child node, process legend with same naming computation algorithm.2070 -1 // Plus do the same for role="group" and role="radiogroup" with embedded role="legend", or a combination of these.2071 -1 if (isFieldset) {2072 -1 var fChild =2073 -1 firstChild(node, ["legend"], ["legend"]) || false;2074 -1 if (fChild) {2075 -1 name = trim(2076 -1 walk(fChild, stop, false, [], false, {2077 -1 ref: ownedBy,2078 -1 top: fChild,2079 -1 }).name,2080 -1 );2081 -1 }2082 -1 if (trim(name)) {2083 -1 hasName = true;2084 -1 }2085 -1 skip = true;2086 -1 }2087 -12088 -1 var isTable =2089 -1 !skipTo.tag &&2090 -1 !skipTo.role &&2091 -1 !hasName &&2092 -1 node === rootNode &&2093 -1 (nRole === "table" || (!nRole && nTag === "table"));2094 -12095 -1 // Otherwise, if name is still empty and the current node matches the root node and is a standard table element with a non-empty associated caption element as the first child node, process caption with same naming computation algorithm.2096 -1 // Plus do the same for role="table" with embedded role="caption", or a combination of these.2097 -1 if (isTable) {2098 -1 fChild = firstChild(node, ["caption"], ["caption"]) || false;2099 -1 if (fChild) {2100 -1 name = trim(2101 -1 walk(fChild, stop, false, [], false, {2102 -1 ref: ownedBy,2103 -1 top: fChild,2104 -1 }).name,2105 -1 );2106 -1 }2107 -1 if (trim(name)) {2108 -1 hasName = true;2109 -1 }2110 -1 skip = true;2111 -1 }2112 -12113 -1 // Otherwise, if name is still empty and the root node and the current node are the same and node is an svg element, then parse the content of the title element to set the name and the desc element to set the description.2114 -1 if (!skipTo.tag && !skipTo.role && nTag === "svg") {2115 -1 var svgT = node.querySelector("title") || false;2116 -1 var svgD =2117 -1 (node === rootNode && node.querySelector("desc")) || false;2118 -1 if (!hasName && svgT) {2119 -1 name = trim(2120 -1 walk(svgT, true, false, [], false, {2121 -1 ref: ownedBy,2122 -1 top: svgT,2123 -1 }).name,2124 -1 );2125 -1 }2126 -1 if (!hasDesc && svgD) {2127 -1 var dE = trim(2128 -1 walk(svgD, true, false, [], false, {2129 -1 ref: ownedBy,2130 -1 top: svgD,2131 -1 }).name,2132 -1 );2133 -1 if (trim(dE)) {2134 -1 result.desc = dE;2135 -1 }2136 -1 }2137 -1 result.skip = true;2138 -1 }2139 -1 }2140 -12141 -1 // Otherwise, if the current node is a nested widget control within the parent ref obj, then add only its value and process no deeper within the branch.2142 -1 if (!skipTo.tag && !skipTo.role && isSeparatChildFormField) {2143 -1 // Prevent the referencing node from having its value included in the case of form control labels that contain the element with focus.2144 -1 if (2145 -1 !(2146 -1 nodesToIgnoreValues &&2147 -1 nodesToIgnoreValues.length &&2148 -1 nodesToIgnoreValues.indexOf(node) !== -12149 -1 )2150 -1 ) {2151 -1 if (isRangeWidgetRole) {2152 -1 // For range widgets, append aria-valuetext if non-empty, or aria-valuenow if non-empty, or node.value if applicable.2153 -1 name = getObjectValue(nRole, node, true);2154 -1 } else if (2155 -1 isEditWidgetRole ||2156 -1 (nRole === "combobox" && isNativeFormField)2157 -1 ) {2158 -1 // For simulated edit widgets, append text from content if applicable, or node.value if applicable.2159 -1 name = getObjectValue(nRole, node, false, true);2160 -1 } else if (isSelectWidgetRole) {2161 -1 // For simulated select widgets, append same naming computation algorithm for all child nodes including aria-selected="true" separated by a space when multiple.2162 -1 // Also filter nodes so that only valid child roles of relevant parent role that include aria-selected="true" are included.2163 -1 name = getObjectValue(nRole, node, false, false, true);2164 -1 } else if (2165 -1 isNativeFormField &&2166 -1 ["input", "textarea"].indexOf(nTag) !== -1 &&2167 -1 (!isWidgetRole || isEditWidgetRole)2168 -1 ) {2169 -1 // For native edit fields, append node.value when applicable.2170 -1 name = getObjectValue(2171 -1 nRole,2172 -1 node,2173 -1 false,2174 -1 false,2175 -1 false,2176 -1 true,2177 -1 );2178 -1 } else if (2179 -1 isNativeFormField &&2180 -1 nTag === "select" &&2181 -1 (!isWidgetRole || nRole === "combobox")2182 -1 ) {2183 -1 // For native select fields, get text from content for all options with selected attribute separated by a space when multiple, but don't process if another widget role is present unless it matches role="combobox".2184 -1 // Reference: https://github.com/WhatSock/w3c-alternative-text-computation/issues/72185 -1 name = getObjectValue(2186 -1 nRole,2187 -1 node,2188 -1 false,2189 -1 false,2190 -1 true,2191 -1 true,2192 -1 );2193 -1 }2194 -12195 -1 // Check for blank value, since whitespace chars alone are not valid as a name2196 -1 name = trim(name);2197 -1 }2198 -1 }2199 -12200 -1 // Otherwise, if current node is the same as rootNode and is non-presentational and includes a non-empty title attribute, store title attribute value as the accessible name if name is still empty, or the description if not.2201 -1 // Processing for this is handled within the walkDOM function.2202 -1 if (2203 -1 !skipTo.tag &&2204 -1 !skipTo.role &&2205 -1 !rolePresentation &&2206 -1 trim(nTitle)2207 -1 ) {2208 -1 if (!(name && aDescription === " ")) {2209 -1 result.title = trim(nTitle);2210 -1 }2211 -1 }2212 -12213 -1 var nType =2214 -1 isNativeFormField &&2215 -1 trim(node.getAttribute("type") || "").toLowerCase();2216 -1 if (!nType) nType = "text";2217 -1 var placeholder =2218 -1 !skipTo.tag &&2219 -1 !skipTo.role &&2220 -1 node === rootNode &&2221 -1 node === refNode &&2222 -1 (isEditWidgetRole ||2223 -1 (isNativeFormField &&2224 -1 (nTag === "textarea" ||2225 -1 (nTag === "input" &&2226 -1 [2227 -1 "password",2228 -1 "search",2229 -1 "tel",2230 -1 "text",2231 -1 "url",2232 -1 "email",2233 -1 ].indexOf(nType) !== -1)))) &&2234 -1 trim(2235 -1 node.getAttribute("placeholder") ||2236 -1 node.getAttribute("aria-placeholder"),2237 -1 );2238 -12239 -1 if (placeholder) {2240 -1 result.placeholder = placeholder;2241 -1 }2242 -12243 -1 var isSkipTo =2244 -1 (skipTo.role && skipTo.role === nRole) ||2245 -1 (!nRole && skipTo.tag && skipTo.tag === nTag);2246 -12247 -1 // Process custom tag and role searches if needed.2248 -1 if (isSkipTo) {2249 -1 name = trim(2250 -1 walk(node, stop, false, [], false, {2251 -1 ref: ownedBy,2252 -1 top: node,2253 -1 }).name,2254 -1 );2255 -1 if (trim(name)) {2256 -1 skip = true;2257 -1 }2258 -1 }2259 -12260 -1 // Check for non-empty value of aria-owns, follow each ID ref, then process with same naming computation.2261 -1 // Also abort aria-owns processing if contained on an element that does not support child elements.2262 -1 if (2263 -1 !isSkipTo &&2264 -1 aOwns &&2265 -1 ["input", "img", "progress"].indexOf(nTag) === -12266 -1 ) {2267 -1 ids = aOwns.split(/\s+/);2268 -1 parts = [];2269 -1 for (i = 0; i < ids.length; i++) {2270 -1 element = docO.getElementById(ids[i]);2271 -1 // Abort processing if the referenced node has already been traversed2272 -1 if (element && owns.indexOf(ids[i]) === -1) {2273 -1 owns.push(ids[i]);2274 -1 var oBy = { ref: ownedBy, top: ownedBy.top };2275 -1 oBy[ids[i]] = {2276 -1 refNode: refNode,2277 -1 node: node,2278 -1 target: element,2279 -1 };2280 -1 if (!isParentHidden(element, docO.body, true)) {2281 -1 parts.push(2282 -1 walk(element, true, skip, [], false, oBy).name,2283 -1 );2284 -1 }2285 -1 }2286 -1 }2287 -1 // Join without adding whitespace since this is already handled by parsing individual nodes within the algorithm steps.2288 -1 ariaO = parts.join("");2289 -1 }2290 -1 }2291 -12292 -1 // Otherwise, process text node2293 -1 else if (!skipTo.tag && !skipTo.role && node.nodeType === 3) {2294 -1 name = node.data;2295 -1 }2296 -12297 -1 if (!hLabel) {2298 -1 // Prepend and append the current CSS pseudo element text, plus normalize all whitespace such as newline characters and others into flat spaces.2299 -1 name = cssO.before + name.replace(/\s+/g, " ") + cssO.after;2300 -1 }2301 -12302 -1 if (2303 -1 name.length &&2304 -1 !hasParentLabelOrHidden(node, ownedBy.top, ownedBy)2305 -1 ) {2306 -1 result.name = name;2307 -1 }2308 -12309 -1 result.owns = ariaO;2310 -12311 -1 return result;2312 -1 },2313 -1 refNode,2314 -1 );2315 -12316 -1 if (!hasLabel) {2317 -1 // Prepend and append the refObj CSS pseudo element text, plus normalize whitespace chars into flat spaces.2318 -1 fullResult.name =2319 -1 cssOP.before + fullResult.name.replace(/\s+/g, " ") + cssOP.after;2320 -1 }2321 -12322 -1 return fullResult;2323 -1 };2324 -12325 -1 var firstChild = function (e, t, r, s) {2326 -1 e = e ? e.firstChild : null;2327 -1 while (e) {2328 -1 var tr = getRole(e) || false;2329 -1 if (2330 -1 e.nodeType === 1 &&2331 -1 ((!t && !r) ||2332 -1 (tr && r && r.indexOf(tr) !== -1) ||2333 -1 (!tr && t && t.indexOf(e.nodeName.toLowerCase()) !== -1))2334 -1 ) {2335 -1 return e;2336 -1 } else if (!s && e.nodeType === 1 && (t || r)) {2337 -1 return null;2338 -1 }2339 -1 e = e.nextSibling;2340 -1 }2341 -1 return e;2342 -1 };2343 -12344 -1 var lastChild = function (e, t, r, s) {2345 -1 e = e ? e.lastChild : null;2346 -1 while (e) {2347 -1 var tr = getRole(e) || false;2348 -1 if (2349 -1 e.nodeType === 1 &&2350 -1 ((!t && !r) ||2351 -1 (tr && r && r.indexOf(tr) !== -1) ||2352 -1 (!tr && t && t.indexOf(e.nodeName.toLowerCase()) !== -1))2353 -1 ) {2354 -1 return e;2355 -1 } else if (!s && e.nodeType === 1 && (t || r)) {2356 -1 return null;2357 -1 }2358 -1 e = e.previousSibling;2359 -1 }2360 -1 return e;2361 -1 };2362 -12363 -1 var getRole = function (node) {2364 -1 var role =2365 -1 node && node.getAttribute2366 -1 ? (node.getAttribute("role") || "").toLowerCase()2367 -1 : "";2368 -1 if (!trim(role)) {2369 -1 return "";2370 -1 }2371 -1 var inList = function (list) {2372 -1 return trim(role).length > 0 && list.roles.indexOf(role) >= 0;2373 -1 };2374 -1 var roles = role.split(/\s+/);2375 -1 for (var i = 0; i < roles.length; i++) {2376 -1 role = roles[i];2377 -1 if (2378 -1 inList(list1) ||2379 -1 inList(list2) ||2380 -1 inList(list3) ||2381 -1 inList(list4) ||2382 -1 presentationRoles.indexOf(role) !== -12383 -1 ) {2384 -1 return role;2385 -1 }2386 -1 }2387 -1 return "";2388 -1 };2389 -12390 -1 var isFocusable = function (node) {2391 -1 var nodeName = node.nodeName.toLowerCase();2392 -1 if (node.getAttribute("tabindex")) {2393 -1 return true;2394 -1 }2395 -1 if (nodeName === "a" && node.getAttribute("href")) {2396 -1 return true;2397 -1 }2398 -1 return (2399 -1 ["button", "input", "select", "textarea"].indexOf(nodeName) !== -1 &&2400 -1 (node.getAttribute("type") || "").toLowerCase() !== "hidden"2401 -1 );2402 -1 };2403 -12404 -1 // ARIA Role Exception Rule Set 1.22405 -1 // The following Role Exception Rule Set is based on the following ARIA Working Group discussion involving all relevant browser venders.2406 -1 // https://lists.w3.org/Archives/Public/public-aria/2017Jun/0057.html2407 -12408 -1 // Always include name from content when the referenced node matches list1, as well as when child nodes match those within list32409 -1 // Note: gridcell was added to list1 to account for focusable gridcells that match the ARIA 1.0 paradigm for interactive grids.2410 -1 // So too was row to match 'name from author' and 'name from content' in accordance with the spec.2411 -1 var list1 = {2412 -1 roles: [2413 -1 "button",2414 -1 "checkbox",2415 -1 "link",2416 -1 "option",2417 -1 "radio",2418 -1 "switch",2419 -1 "tab",2420 -1 "treeitem",2421 -1 "menuitem",2422 -1 "menuitemcheckbox",2423 -1 "menuitemradio",2424 -1 "row",2425 -1 "cell",2426 -1 "gridcell",2427 -1 "columnheader",2428 -1 "rowheader",2429 -1 "tooltip",2430 -1 "heading",2431 -1 ],2432 -1 tags: [2433 -1 "a",2434 -1 "button",2435 -1 "summary",2436 -1 "input",2437 -1 "h1",2438 -1 "h2",2439 -1 "h3",2440 -1 "h4",2441 -1 "h5",2442 -1 "h6",2443 -1 "menuitem",2444 -1 "option",2445 -1 "tr",2446 -1 "td",2447 -1 "th",2448 -1 ],2449 -1 };2450 -1 // Never include name from content when current node matches list22451 -1 // The rowgroup role was added to prevent 'name from content' in accordance with relevant ARIA 1.1 spec changes.2452 -1 // The fieldset element and group role was added to account for implicit mappings where name from content is not supported.2453 -1 var list2 = {2454 -1 roles: [2455 -1 "application",2456 -1 "alert",2457 -1 "log",2458 -1 "marquee",2459 -1 "timer",2460 -1 "alertdialog",2461 -1 "dialog",2462 -1 "banner",2463 -1 "complementary",2464 -1 "form",2465 -1 "main",2466 -1 "navigation",2467 -1 "progressbar",2468 -1 "region",2469 -1 "search",2470 -1 "article",2471 -1 "document",2472 -1 "feed",2473 -1 "figure",2474 -1 "img",2475 -1 "math",2476 -1 "toolbar",2477 -1 "menu",2478 -1 "menubar",2479 -1 "grid",2480 -1 "listbox",2481 -1 "radiogroup",2482 -1 "textbox",2483 -1 "searchbox",2484 -1 "spinbutton",2485 -1 "scrollbar",2486 -1 "slider",2487 -1 "tablist",2488 -1 "tabpanel",2489 -1 "tree",2490 -1 "treegrid",2491 -1 "separator",2492 -1 "rowgroup",2493 -1 "group",2494 -1 ],2495 -1 tags: [2496 -1 "article",2497 -1 "aside",2498 -1 "body",2499 -1 "select",2500 -1 "datalist",2501 -1 "optgroup",2502 -1 "dialog",2503 -1 "figure",2504 -1 "footer",2505 -1 "form",2506 -1 "header",2507 -1 "hr",2508 -1 "iframe",2509 -1 "img",2510 -1 "textarea",2511 -1 "input",2512 -1 "main",2513 -1 "math",2514 -1 "menu",2515 -1 "nav",2516 -1 "section",2517 -1 "thead",2518 -1 "tbody",2519 -1 "tfoot",2520 -1 "fieldset",2521 -1 "progress",2522 -1 ],2523 -1 };2524 -1 // As an override of list2, conditionally include name from content if current node is focusable, or if the current node matches list3 while the referenced parent node (root node) matches list1.2525 -1 var list3 = {2526 -1 roles: [2527 -1 "term",2528 -1 "definition",2529 -1 "directory",2530 -1 "list",2531 -1 "note",2532 -1 "status",2533 -1 "table",2534 -1 "contentinfo",2535 -1 ],2536 -1 tags: ["dl", "ul", "ol", "dd", "details", "output", "table"],2537 -1 };2538 -1 // Subsequent roles added as part of the Role Parity project for ARIA 1.2.2539 -1 // Tracks roles that don't specifically belong within the prior process lists.2540 -1 var list4 = {2541 -1 roles: [2542 -1 "legend",2543 -1 "caption",2544 -1 "code",2545 -1 "deletion",2546 -1 "emphasis",2547 -1 "generic",2548 -1 "insertion",2549 -1 "paragraph",2550 -1 "strong",2551 -1 "subscript",2552 -1 "superscript",2553 -1 ],2554 -1 tags: [2555 -1 "legend",2556 -1 "caption",2557 -1 "figcaption",2558 -1 "code",2559 -1 "del",2560 -1 "em",2561 -1 "div",2562 -1 "span",2563 -1 "ins",2564 -1 "p",2565 -1 "strong",2566 -1 "sub",2567 -1 "sup",2568 -1 ],2569 -1 };2570 -12571 -1 var genericElements = ["div", "span"];2572 -1 var nameProhibitedRoles = [2573 -1 "caption",2574 -1 "code",2575 -1 "deletion",2576 -1 "emphasis",2577 -1 "generic",2578 -1 "insertion",2579 -1 "none",2580 -1 "paragraph",2581 -1 "presentation",2582 -1 "strong",2583 -1 "subscript",2584 -1 "superscript",2585 -1 ];2586 -1 var nameProhibitedElements = [2587 -1 "caption",2588 -1 "figcaption",2589 -1 "code",2590 -1 "del",2591 -1 "em",2592 -1 "div",2593 -1 "span",2594 -1 "ins",2595 -1 "p",2596 -1 "strong",2597 -1 "sub",2598 -1 "sup",2599 -1 ];2600 -12601 -1 var nativeFormFields = [2602 -1 "button",2603 -1 "input",2604 -1 "progress",2605 -1 "select",2606 -1 "textarea",2607 -1 ];2608 -1 var rangeWidgetRoles = [2609 -1 "scrollbar",2610 -1 "slider",2611 -1 "spinbutton",2612 -1 "progressbar",2613 -1 ];2614 -1 var editWidgetRoles = ["searchbox", "textbox"];2615 -1 var selectWidgetRoles = [2616 -1 "grid",2617 -1 "listbox",2618 -1 "tablist",2619 -1 "tree",2620 -1 "treegrid",2621 -1 ];2622 -1 var otherWidgetRoles = [2623 -1 "button",2624 -1 "checkbox",2625 -1 "link",2626 -1 "switch",2627 -1 "option",2628 -1 "menu",2629 -1 "menubar",2630 -1 "menuitem",2631 -1 "menuitemcheckbox",2632 -1 "menuitemradio",2633 -1 "radio",2634 -1 "tab",2635 -1 "treeitem",2636 -1 "gridcell",2637 -1 ];2638 -1 var presentationRoles = ["presentation", "none"];2639 -12640 -1 var hasGlobalAttr = function (node) {2641 -1 var globalPropsAndStates = [2642 -1 "labelledby",2643 -1 "label",2644 -1 "describedby",2645 -1 "busy",2646 -1 "controls",2647 -1 "current",2648 -1 "details",2649 -1 "disabled",2650 -1 "dropeffect",2651 -1 "errormessage",2652 -1 "flowto",2653 -1 "grabbed",2654 -1 "haspopup",2655 -1 "invalid",2656 -1 "keyshortcuts",2657 -1 "live",2658 -1 "owns",2659 -1 "roledescription",2660 -1 ];2661 -1 for (var i = 0; i < globalPropsAndStates.length; i++) {2662 -1 var a = trim(node.getAttribute("aria-" + globalPropsAndStates[i]));2663 -1 if (a) {2664 -1 return true;2665 -1 }2666 -1 }2667 -1 return false;2668 -1 };2669 -12670 -1 var isHidden =2671 -1 overrides.isHidden ||2672 -1 function (node, refNode) {2673 -1 var hidden = function (node) {2674 -1 if (!node || node.nodeType !== 1 || node === refNode) {2675 -1 return false;2676 -1 }2677 -1 if (node.getAttribute("aria-hidden") === "true") {2678 -1 return true;2679 -1 }2680 -1 if (node.getAttribute("hidden")) {2681 -1 return true;2682 -1 }2683 -1 var style = getStyleObject(node);2684 -1 return (2685 -1 style["display"] === "none" || style["visibility"] === "hidden"2686 -1 );2687 -1 };2688 -1 return hidden(node);2689 -1 };2690 -12691 -1 var isParentHidden = function (node, refNode, skipOwned, skipCurrent) {2692 -1 while (node && node !== refNode) {2693 -1 if (!skipCurrent && node.nodeType === 1 && isHidden(node, refNode)) {2694 -1 return true;2695 -1 } else skipCurrent = false;2696 -1 node = node.parentNode;2697 -1 }2698 -1 return false;2699 -1 };2700 -12701 -1 var getStyleObject =2702 -1 overrides.getStyleObject ||2703 -1 function (node) {2704 -1 var style = {};2705 -1 if (docO.defaultView && docO.defaultView.getComputedStyle) {2706 -1 style = docO.defaultView.getComputedStyle(node, "");2707 -1 } else if (node.currentStyle) {2708 -1 style = node.currentStyle;2709 -1 }2710 -1 return style;2711 -1 };2712 -12713 -1 var cleanCSSText = function (node, text) {2714 -1 var s = text;2715 -1 if (s.indexOf("attr(") !== -1) {2716 -1 var m = s.match(/attr\((.|\n|\r\n)*?\)/g);2717 -1 for (var i = 0; i < m.length; i++) {2718 -1 var b = m[i].slice(5, -1);2719 -1 b = node.getAttribute(b) || "";2720 -1 s = s.replace(m[i], b);2721 -1 }2722 -1 }2723 -1 s = s.replace(/url\((.*?)\)\s+\/|url\((.*?)\)/g, "").replace(/\"/g, "");2724 -1 return s;2725 -1 };2726 -12727 -1 var isBlockLevelElement = function (node, cssObj) {2728 -1 var styleObject = cssObj || getStyleObject(node);2729 -1 for (var prop in blockStyles) {2730 -1 var values = blockStyles[prop];2731 -1 for (var i = 0; i < values.length; i++) {2732 -1 if (2733 -1 styleObject[prop] &&2734 -1 ((values[i].indexOf("!") === 0 &&2735 -1 [values[i].slice(1), "inherit", "initial", "unset"].indexOf(2736 -1 styleObject[prop],2737 -1 ) === -1) ||2738 -1 styleObject[prop].indexOf(values[i]) === 0)2739 -1 ) {2740 -1 return true;2741 -1 }2742 -1 }2743 -1 }2744 -1 return (2745 -1 !cssObj &&2746 -1 node.nodeName &&2747 -1 blockElements.indexOf(node.nodeName.toLowerCase()) !== -1 &&2748 -1 !(2749 -1 styleObject["display"] &&2750 -1 styleObject["display"].indexOf("inline") === 0 &&2751 -1 node.nodeName.toLowerCase() !== "br"2752 -1 )2753 -1 );2754 -1 };2755 -12756 -1 // CSS Block Styles indexed from:2757 -1 // https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context2758 -1 var blockStyles = {2759 -1 display: ["block", "grid", "table", "flow-root", "flex"],2760 -1 position: ["absolute", "fixed"],2761 -1 float: ["left", "right", "inline"],2762 -1 clear: ["left", "right", "both", "inline"],2763 -1 overflow: ["hidden", "scroll", "auto"],2764 -1 "column-count": ["!auto"],2765 -1 "column-width": ["!auto"],2766 -1 "column-span": ["all"],2767 -1 contain: ["layout", "content", "strict"],2768 -1 };2769 -12770 -1 // HTML5 Block Elements indexed from:2771 -1 // https://github.com/webmodules/block-elements2772 -1 // Note: 'br' was added to this array because it impacts visual display and should thus add a space .2773 -1 // Reference issue: https://github.com/w3c/accname/issues/42774 -1 // Note: Added in 1.13, td, th, tr, and legend2775 -1 var blockElements = [2776 -1 "address",2777 -1 "article",2778 -1 "aside",2779 -1 "blockquote",2780 -1 "br",2781 -1 "canvas",2782 -1 "dd",2783 -1 "div",2784 -1 "dl",2785 -1 "dt",2786 -1 "fieldset",2787 -1 "figcaption",2788 -1 "figure",2789 -1 "footer",2790 -1 "form",2791 -1 "h1",2792 -1 "h2",2793 -1 "h3",2794 -1 "h4",2795 -1 "h5",2796 -1 "h6",2797 -1 "header",2798 -1 "hgroup",2799 -1 "hr",2800 -1 "legend",2801 -1 "li",2802 -1 "main",2803 -1 "nav",2804 -1 "noscript",2805 -1 "ol",2806 -1 "output",2807 -1 "p",2808 -1 "pre",2809 -1 "section",2810 -1 "table",2811 -1 "td",2812 -1 "tfoot",2813 -1 "th",2814 -1 "tr",2815 -1 "ul",2816 -1 "video",2817 -1 ];2818 -12819 -1 var getObjectValue = function (2820 -1 role,2821 -1 node,2822 -1 isRange,2823 -1 isEdit,2824 -1 isSelect,2825 -1 isNative,2826 -1 ) {2827 -1 var val = "";2828 -1 var bypass = false;2829 -12830 -1 if (isRange && !isNative) {2831 -1 val =2832 -1 node.getAttribute("aria-valuetext") ||2833 -1 node.getAttribute("aria-valuenow") ||2834 -1 "";2835 -1 } else if (isEdit && !isNative) {2836 -1 val = getText(node) || "";2837 -1 } else if (isSelect && !isNative) {2838 -1 var childRoles = [];2839 -1 if (role === "grid" || role === "treegrid") {2840 -1 childRoles = ["gridcell", "rowheader", "columnheader"];2841 -1 } else if (role === "listbox") {2842 -1 childRoles = ["option"];2843 -1 } else if (role === "tablist") {2844 -1 childRoles = ["tab"];2845 -1 } else if (role === "tree") {2846 -1 childRoles = ["treeitem"];2847 -1 }2848 -1 val = joinSelectedParts(2849 -1 node,2850 -1 node.querySelectorAll('*[aria-selected="true"]'),2851 -1 false,2852 -1 childRoles,2853 -1 );2854 -1 bypass = true;2855 -1 }2856 -1 val = trim(val);2857 -1 if (!val && (isRange || isEdit) && node.value) {2858 -1 val = node.value;2859 -1 }2860 -1 if (!bypass && !val && isNative) {2861 -1 if (isSelect) {2862 -1 val = joinSelectedParts(2863 -1 node,2864 -1 node.querySelectorAll("option[selected]"),2865 -1 true,2866 -1 );2867 -1 } else {2868 -1 val = node.value;2869 -1 }2870 -1 }2871 -12872 -1 return val;2873 -1 };2874 -12875 -1 var addSpacing = function (s) {2876 -1 return trim(s).length ? " " + s + " " : " ";2877 -1 };2878 -12879 -1 var joinSelectedParts = function (node, nOA, isNative, childRoles) {2880 -1 if (!nOA || !nOA.length) {2881 -1 return "";2882 -1 }2883 -1 var parts = [];2884 -1 for (var i = 0; i < nOA.length; i++) {2885 -1 var role = getRole(nOA[i]);2886 -1 var isValidChildRole = !childRoles || childRoles.indexOf(role) !== -1;2887 -1 if (isValidChildRole) {2888 -1 parts.push(2889 -1 isNative2890 -1 ? getText(nOA[i])2891 -1 : walk(nOA[i], true, false, [], false, { top: nOA[i] }).name,2892 -1 );2893 -1 }2894 -1 }2895 -1 return parts.join(" ");2896 -1 };2897 -12898 -1 var getPseudoElStyleObj =2899 -1 overrides.getPseudoElStyleObj ||2900 -1 function (node, position) {2901 -1 var styleObj = {};2902 -1 for (var prop in blockStyles) {2903 -1 styleObj[prop] = docO.defaultView2904 -1 .getComputedStyle(node, position)2905 -1 .getPropertyValue(prop);2906 -1 }2907 -1 styleObj["content"] = docO.defaultView2908 -1 .getComputedStyle(node, position)2909 -1 .getPropertyValue("content")2910 -1 .replace(/^"|\\|"$/g, "");2911 -1 return styleObj;2912 -1 };2913 -12914 -1 var getText = function (node, position) {2915 -1 if (!position && node.nodeType === 1) {2916 -1 return node.innerText || node.textContent || "";2917 -1 }2918 -1 var styles = getPseudoElStyleObj(node, position);2919 -1 var text = styles["content"];2920 -1 if (!text || text === "none") {2921 -1 return "";2922 -1 }2923 -1 if (isBlockLevelElement({}, styles)) {2924 -1 if (position === ":before") {2925 -1 text += " ";2926 -1 } else if (position === ":after") {2927 -1 text = " " + text;2928 -1 }2929 -1 }2930 -1 return text;2931 -1 };2932 -12933 -1 var getCSSText =2934 -1 overrides.getCSSText ||2935 -1 function (node, refNode) {2936 -1 if (2937 -1 (node && node.nodeType !== 1) ||2938 -1 node === refNode ||2939 -1 [2940 -1 "input",2941 -1 "select",2942 -1 "textarea",2943 -1 "img",2944 -1 "iframe",2945 -1 "optgroup",2946 -1 ].indexOf(node.nodeName.toLowerCase()) !== -12947 -1 ) {2948 -1 return { before: "", after: "" };2949 -1 }2950 -1 return {2951 -1 before: cleanCSSText(node, getText(node, ":before")),2952 -1 after: cleanCSSText(node, getText(node, ":after")),2953 -1 };2954 -1 };2955 -12956 -1 var getParent = function (node, nTag, nRole, noRole) {2957 -1 noRole = !!noRole;2958 -1 while (node) {2959 -1 node = node.parentNode;2960 -1 if (2961 -1 node &&2962 -1 ((nRole && getRole(node) === nRole) ||2963 -1 (nTag &&2964 -1 node.nodeName &&2965 -1 node.nodeName.toLowerCase() === nTag &&2966 -1 (!noRole || getRole(node).length < 1)))2967 -1 ) {2968 -1 return node;2969 -1 }2970 -1 }2971 -1 return {};2972 -1 };2973 -12974 -1 var hasParentLabelOrHidden = function (2975 -1 node,2976 -1 refNode,2977 -1 ownedBy,2978 -1 ignoreHidden,2979 -1 ) {2980 -1 var trackNodes = [];2981 -1 while (node && node !== refNode) {2982 -1 if (2983 -1 node.id &&2984 -1 ownedBy &&2985 -1 ownedBy[node.id] &&2986 -1 ownedBy[node.id].node &&2987 -1 trackNodes.indexOf(node) === -12988 -1 ) {2989 -1 trackNodes.push(node);2990 -1 node = ownedBy[node.id].node;2991 -1 } else {2992 -1 node = node.parentNode;2993 -1 }2994 -1 if (node && node.getAttribute) {2995 -1 if (2996 -1 trim(node.getAttribute("aria-label")) ||2997 -1 (!ignoreHidden && isHidden(node, refNode))2998 -1 ) {2999 -1 return true;3000 -1 }3001 -1 }3002 -1 }3003 -1 return false;3004 -1 };3005 -13006 -1 if (3007 -1 isParentHidden(3008 -1 node,3009 -1 docO.body,3010 -1 true,3011 -1 !!(node && node.nodeName && node.nodeName.toLowerCase() === "area"),3012 -1 )3013 -1 ) {3014 -1 return props;3015 -1 }3016 -13017 -1 // Compute accessible Name and Description properties value for node3018 -1 var accProps = walk(node, false, false, [], false, { top: node });3019 -13020 -1 var accName = trim(accProps.name.replace(/\s+/g, " "));3021 -1 var accDesc = trim(accProps.title.replace(/\s+/g, " "));3022 -13023 -1 // if (accName === accDesc) {3024 -1 // If both Name and Description properties match, then clear the Description property value. (Ideal but not in the spec so commented out.)3025 -1 // accDesc = "";3026 -1 // }3027 -13028 -1 props.hasUpperCase =3029 -1 rootRole && rootRole !== rootRole.toLowerCase() ? true : false;3030 -1 props.name = accName;3031 -1 props.desc = accDesc;3032 -13033 -1 // Clear track variables3034 -1 nodes = {3035 -1 name: [],3036 -1 desc: [],3037 -1 };3038 -1 owns = [];3039 -1 } catch (e) {3040 -1 props.error = e;3041 -1 }3042 -1 props.placeholder = nameFromPlaceholder;3043 -1 props.userAgent = nameFromUserAgent;3044 -13045 -1 if (fnc && typeof fnc === "function") {3046 -1 return fnc.apply(node, [props, node]);3047 -1 } else {3048 -1 return props;3049 -1 }3050 -1 };3051 -13052 -1 var trim = function (str) {3053 -1 if (typeof str !== "string") {3054 -1 return "";3055 -1 }3056 -1 return str.replace(/^\s+|\s+$/g, "");3057 -1 };3058 -13059 -1 // Customize returned string for testable statements3060 -13061 -1 nameSpace.getAccNameMsg = nameSpace.getNames = function (node, overrides) {3062 -1 var props = nameSpace.getAccName(node, null, false, overrides);3063 -1 if (props.error) {3064 -1 return (3065 -1 props.error +3066 -1 "\n\n" +3067 -1 "An error has been thrown in AccName Prototype version " +3068 -1 nameSpace.getAccNameVersion +3069 -1 ". Please copy this error message and the HTML markup that caused it, and submit both as a new GitHub issue at\n" +3070 -1 "https://github.com/whatsock/w3c-alternative-text-computation"3071 -1 );3072 -1 }3073 -1 var r =3074 -1 'accName: "' + props.name + '"\n\naccDesc: "' + props.desc + '"\n\n';3075 -1 if (props.placeholder) r += "Name from placeholder: true\n\n";3076 -1 if (props.userAgent) r += "Name from user agent: true\n\n";3077 -1 r +=3078 -1 "(Running AccName Computation Prototype version: " +3079 -1 nameSpace.getAccNameVersion +3080 -1 ")";3081 -1 return r;3082 -1 };3083 -13084 -1 if (typeof module === "object" && module.exports) {3085 -1 module.exports = {3086 -1 getNames: nameSpace.getNames,3087 -1 calcNames: nameSpace.calcNames,3088 -1 };3089 -1 }3090 -1 })();3091 -13092 -1 },{}]},{},[3]);
diff --git a/fuzz/fuzzer.js b/fuzz/fuzzer.js
@@ -1,51 +0,0 @@1 -1 var getFingerprint = function(covPath) {2 -1 var coverage = window.__coverage__[covPath].b;3 -1 var fingerprint = Object.values(coverage).map(x => x.join(':')).join('-');4 -1 for (var key in coverage) {5 -1 for (var i = 0; i < coverage[key].length; i++) {6 -1 coverage[key][i] = 0;7 -1 }8 -1 }9 -1 return fingerprint;10 -1 };11 -112 -1 var run = function(corpus, oracle, covPath, onFingerprint, onReport, done) {13 -1 var fingerprints = [];14 -1 var queue = [];15 -1 var count = 0;16 -1 var batchSize = 10;17 -118 -1 corpus.forEach(function(item) {19 -1 queue.push(item);20 -1 });21 -122 -1 var step = function() {23 -1 for (var i = 0; i < batchSize && queue.length; i++) {24 -1 var item = queue.shift();25 -1 var report = oracle(item);26 -1 var fingerprint = getFingerprint(covPath);27 -128 -1 if (!fingerprints.includes(fingerprint)) {29 -1 fingerprints.push(fingerprint);30 -1 item.mutate().forEach(mutation => queue.push(mutation));31 -1 onFingerprint(fingerprint, fingerprints.length);32 -133 -1 if (report) {34 -1 onReport(report);35 -1 }36 -1 }37 -1 }38 -139 -1 if (queue.length) {40 -1 setTimeout(step);41 -1 } else {42 -1 done();43 -1 }44 -1 };45 -146 -1 step();47 -1 };48 -149 -1 module.exports = {50 -1 'run': run,51 -1 };
diff --git a/fuzz/html.js b/fuzz/html.js
@@ -1,147 +0,0 @@1 -1 var constants = require('aria-api/lib/constants');2 -13 -1 var attributes = [4 -1 ['role', Object.keys(constants.roles)],5 -1 ['hidden', ['']],6 -1 ['aria-hidden', ['', 'true', 'false']],7 -1 ['aria-label', ['', '__random__']],8 -1 ['title', ['', '__random__']],9 -1 ['value', ['', '__random__']],10 -1 ['placeholder', ['', '__random__']],11 -1 ['alt', ['', '__random__']],12 -1 ['aria-valuenow', ['', '__random__']],13 -1 ['aria-valuetext', ['', '__random__']],14 -1 ['aria-labelledby', ['__randint__']],15 -1 ['aria-owns', ['__randint__']],16 -1 ['list', ['__randint__']],17 -1 ['for', ['__randint__']],18 -1 ['type', ['', '__random__', 'hidden', 'checkbox', 'text', 'password', 'color', 'reset']],19 -1 ['style', ['', '__random__', 'display: none', 'display: block', 'display: inline-block', 'display: inline', 'visibility: hidden']],20 -1 ];21 -122 -1 var tags = ['a', 'button', 'form', 'label', 'input', 'article', 'table', 'td', 'tr', 'th', 'pre', 'legend', 'h1', 'div', 'span', 'fieldset', 'img', 'abbr', 'strong', 'br', 'hr', 'select', 'option'];23 -124 -1 var randomInt = function(n) {25 -1 return Math.floor(Math.random() * n);26 -1 };27 -128 -1 var randomChoice = function(list) {29 -1 return list[randomInt(list.length)];30 -1 };31 -132 -1 var randomString = function(len) {33 -1 var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 -_.,#';34 -1 var result = '';35 -1 for (var i = 0; i < len; i++) {36 -1 result += randomChoice(chars);37 -1 }38 -1 return result;39 -1 };40 -141 -1 function AttributeList(len) {42 -1 this.value = [];43 -1 for (var i = 0; i < len; i++) {44 -1 var attr = randomChoice(attributes);45 -1 var value = randomChoice(attr[1]);46 -1 if (value === '__random__') {47 -1 // shortcut: always use fixed string length48 -1 value = randomString(10);49 -1 } else if (value === '__randint__') {50 -1 value = randomInt(len);51 -1 }52 -1 this.value.push(attr[0] + '="' + value + '"');53 -1 }54 -1 }55 -156 -1 AttributeList.prototype.shrink = function() {57 -1 var result = [];58 -1 for (var i = 0; i < this.value.length; i++) {59 -1 var item = new AttributeList(0);60 -1 for (var j = 0; j < this.value.length; j++) {61 -1 if (j !== i) {62 -1 item.value.push(this.value[j]);63 -1 }64 -1 }65 -1 result.push(item);66 -1 }67 -1 return result;68 -1 };69 -170 -1 function Element(len, ctx) {71 -1 ctx = ctx || {k: 0};72 -1 this.tag = randomChoice(tags);73 -1 this.id = ctx.k;74 -1 this.content = ctx.k;75 -1 ctx.k += 1;76 -1 this.attrs = new AttributeList(randomInt(len));77 -1 this.children = new Children(randomInt(len), ctx);78 -1 }79 -180 -1 Element.prototype.shrink = function() {81 -1 var result = [];82 -1 var tag = this.tag;83 -1 var id = this.id;84 -1 var content = this.content;85 -1 var attrsList = [this.attrs].concat(this.attrs.shrink());86 -1 var childrenList = [this.children].concat(this.children.shrink());87 -1 attrsList.forEach(function(attrs) {88 -1 childrenList.forEach(function(children) {89 -1 if (attrs !== this.attrs || children !== this.children) {90 -1 var item = new Element(0, {});91 -1 item.tag = tag;92 -1 item.id = id;93 -1 item.content = content;94 -1 item.attrs = attrs;95 -1 item.children = children;96 -1 result.push(item);97 -1 }98 -1 });99 -1 });100 -1 return result;101 -1 };102 -1103 -1 Element.prototype.mutate = function() {104 -1 return this.shrink();105 -1 };106 -1107 -1 Element.prototype.toString = function() {108 -1 var s = '<' + this.tag + ' id="' + this.id + '"';109 -1 this.attrs.value.forEach(function(attr) {110 -1 s += ' ' + attr;111 -1 });112 -1 s += '>' + this.content;113 -1 this.children.value.forEach(function(child) {114 -1 s += child.toString();115 -1 });116 -1 s += '</' + this.tag + '>';117 -1 return s;118 -1 };119 -1120 -1 function Children(len, ctx) {121 -1 this.value = [];122 -1 for (var i = 0; i < len; i++) {123 -1 this.value.push(new Element(randomInt(len), ctx));124 -1 }125 -1 }126 -1127 -1 Children.prototype.shrink = function() {128 -1 var result = [];129 -1 for (var i = 0; i < this.value.length; i++) {130 -1 var item = new Children(0, {});131 -1 for (var j = 0; j < this.value.length; j++) {132 -1 if (j !== i) {133 -1 // shortcut: pick random shrink result134 -1 var shrunken = this.value[j].shrink();135 -1 if (shrunken.length) {136 -1 item.value.push(randomChoice(shrunken));137 -1 }138 -1 }139 -1 }140 -1 result.push(item);141 -1 }142 -1 return result;143 -1 };144 -1145 -1 module.exports = {146 -1 'Element': Element,147 -1 };
diff --git a/fuzz/index.js b/fuzz/index.js
@@ -1,66 +0,0 @@1 -1 var ariaApi = require('aria-api/instrumented.js');2 -1 var accdc = require('w3c-alternative-text-computation');3 -14 -1 var fuzzer = require('./fuzzer');5 -1 var html = require('./html');6 -17 -1 var preview = document.querySelector('#ba-preview');8 -1 var fingerprints = document.querySelector('#ba-fingerprints');9 -1 var errors = document.querySelector('#ba-errors');10 -1 var reports = document.querySelector('#ba-reports');11 -112 -1 var oracle = function(input) {13 -1 preview.innerHTML = input.toString();14 -1 var el = preview.querySelector('#test') || preview.children[0] || preview;15 -1 var v1, v2;16 -117 -1 try {18 -1 v1 = accdc.calcNames(el).name;19 -1 } catch (error) {20 -1 v1 = error;21 -1 }22 -123 -1 try {24 -1 v2 = ariaApi.getName(el);25 -1 } catch (error) {26 -1 v2 = error;27 -1 }28 -129 -1 if (v1 !== v2) {30 -1 return {31 -1 'html': preview.innerHTML,32 -1 'v1': v1,33 -1 'v2': v2,34 -1 };35 -1 }36 -1 };37 -138 -1 var renderReport = function(report) {39 -1 var tr = document.createElement('tr');40 -1 var td1 = document.createElement('td');41 -1 td1.textContent = report.html;42 -1 tr.append(td1);43 -1 var td2 = document.createElement('td');44 -1 td2.textContent = report.v1;45 -1 tr.append(td2);46 -1 var td3 = document.createElement('td');47 -1 td3.textContent = report.v2;48 -1 tr.append(td3);49 -1 return tr;50 -1 };51 -152 -1 document.addEventListener('DOMContentLoaded', function() {53 -1 var covPath = 'node_modules/aria-api/lib/name.js';54 -1 var corpus = [];55 -1 for (var i = 0; i < 10; i++) {56 -1 corpus.push(new html.Element(10));57 -1 }58 -1 fuzzer.run(corpus, oracle, covPath, function(fingerprint, c) {59 -1 fingerprints.textContent = c;60 -1 }, function(report) {61 -1 reports.append(renderReport(report));62 -1 errors.textContent = reports.children.length;63 -1 }, function() {64 -1 preview.innerHTML = 'DONE';65 -1 });66 -1 });
diff --git a/package.json b/package.json
@@ -7,7 +7,6 @@ 7 7 "aria-api": "0.7.0", 8 8 "axe-core": "4.9.1", 9 9 "dom-accessibility-api": "0.6.3",10 -1 "nyc": "^15.1.0",11 10 "w3c-alternative-text-computation": "github:WhatSock/w3c-alternative-text-computation#4b59f9877c9ae6282408edb150f64003a59fdb95" 12 11 }, 13 12 "repository": {