- commit
- 25a2d3cce322a24603c8911caa8024a263f4371d
- parent
- 434471f76b74a99fb75dc8d1bab409c5f11cdb48
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2019-03-25 19:41
build
Diffstat
| A | fuzz.js | 2018 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
1 files changed, 2018 insertions, 0 deletions
diff --git a/fuzz.js b/fuzz.js
@@ -0,0 +1,2018 @@
-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){
-1 2 var getFingerprint = function(covPath) {
-1 3 var coverage = window.__coverage__[covPath].b;
-1 4 var fingerprint = Object.values(coverage).map(x => x.join(':')).join('-');
-1 5 for (var key in coverage) {
-1 6 for (var i = 0; i < coverage[key].length; i++) {
-1 7 coverage[key][i] = 0;
-1 8 }
-1 9 }
-1 10 return fingerprint;
-1 11 };
-1 12
-1 13 var run = function(corpus, oracle, covPath, onFingerprint, onReport, done) {
-1 14 var fingerprints = [];
-1 15 var queue = [];
-1 16 var count = 0;
-1 17
-1 18 corpus.forEach(function(item) {
-1 19 queue.push(item);
-1 20 });
-1 21
-1 22 var step = function() {
-1 23 if (queue.length) {
-1 24 var item = queue.shift();
-1 25 var report = oracle(item);
-1 26 var fingerprint = getFingerprint(covPath);
-1 27
-1 28 if (!fingerprints.includes(fingerprint)) {
-1 29 fingerprints.push(fingerprint);
-1 30 item.mutate().forEach(mutation => queue.push(mutation));
-1 31 onFingerprint(fingerprint, fingerprints.length);
-1 32
-1 33 if (report) {
-1 34 onReport(report);
-1 35 }
-1 36 }
-1 37
-1 38 setTimeout(step);
-1 39 } else {
-1 40 done();
-1 41 }
-1 42 };
-1 43
-1 44 step();
-1 45 };
-1 46
-1 47 module.exports = {
-1 48 'run': run,
-1 49 };
-1 50
-1 51 },{}],2:[function(require,module,exports){
-1 52 var constants = require('aria-api/lib/constants');
-1 53
-1 54 var attributes = [
-1 55 ['role', Array.prototype.concat.apply([], Object.values(constants.subRoles)).filter((v, i, a) => a.indexOf(v) === i)],
-1 56 ['hidden', ['']],
-1 57 ['aria-hidden', ['', 'true', 'false']],
-1 58 ['aria-label', ['', '__random__']],
-1 59 ['title', ['', '__random__']],
-1 60 ['value', ['', '__random__']],
-1 61 ['placeholder', ['', '__random__']],
-1 62 ['alt', ['', '__random__']],
-1 63 ['aria-valuenow', ['', '__random__']],
-1 64 ['aria-valuetext', ['', '__random__']],
-1 65 ['aria-labelledby', ['__randint__']],
-1 66 ['aria-owns', ['__randint__']],
-1 67 ['list', ['__randint__']],
-1 68 ['for', ['__randint__']],
-1 69 ['type', ['', '__random__', 'hidden', 'checkbox', 'text', 'password', 'color', 'reset']],
-1 70 ['style', ['', '__random__', 'display: none', 'display: block', 'display: inline-block', 'display: inline', 'visibility: hidden']],
-1 71 ];
-1 72
-1 73 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', 'datalist'];
-1 74
-1 75 var randomInt = function(n) {
-1 76 return Math.floor(Math.random() * n);
-1 77 };
-1 78
-1 79 var randomChoice = function(list) {
-1 80 return list[randomInt(list.length)];
-1 81 };
-1 82
-1 83 var randomString = function(len) {
-1 84 var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 -_.,#';
-1 85 var result = '';
-1 86 for (var i = 0; i < len; i++) {
-1 87 result += randomChoice(chars);
-1 88 }
-1 89 return result;
-1 90 };
-1 91
-1 92 function AttributeList(len) {
-1 93 this.value = [];
-1 94 for (var i = 0; i < len; i++) {
-1 95 var attr = randomChoice(attributes);
-1 96 var value = randomChoice(attr[1]);
-1 97 if (value === '__random__') {
-1 98 // shortcut: always use fixed string length
-1 99 value = randomString(10);
-1 100 } else if (value === '__randint__') {
-1 101 value = randomInt(len);
-1 102 }
-1 103 this.value.push(attr[0] + '="' + value + '"');
-1 104 }
-1 105 }
-1 106
-1 107 AttributeList.prototype.shrink = function() {
-1 108 var result = [];
-1 109 for (var i = 0; i < this.value.length; i++) {
-1 110 var item = new AttributeList(0);
-1 111 for (var j = 0; j < this.value.length; j++) {
-1 112 if (j !== i) {
-1 113 item.value.push(this.value[j]);
-1 114 }
-1 115 }
-1 116 result.push(item);
-1 117 }
-1 118 return result;
-1 119 };
-1 120
-1 121 function Element(len, ctx) {
-1 122 ctx = ctx || {k: 0};
-1 123 this.tag = randomChoice(tags);
-1 124 this.id = ctx.k;
-1 125 this.content = ctx.k;
-1 126 ctx.k += 1;
-1 127 this.attrs = new AttributeList(randomInt(len));
-1 128 this.children = new Children(randomInt(len), ctx);
-1 129 }
-1 130
-1 131 Element.prototype.shrink = function() {
-1 132 var result = [];
-1 133 var tag = this.tag;
-1 134 var id = this.id;
-1 135 var content = this.content;
-1 136 var attrsList = [this.attrs].concat(this.attrs.shrink());
-1 137 var childrenList = [this.children].concat(this.children.shrink());
-1 138 attrsList.forEach(function(attrs) {
-1 139 childrenList.forEach(function(children) {
-1 140 if (attrs !== this.attrs || children !== this.children) {
-1 141 var item = new Element(0, {});
-1 142 item.tag = tag;
-1 143 item.id = id;
-1 144 item.content = content;
-1 145 item.attrs = attrs;
-1 146 item.children = children;
-1 147 result.push(item);
-1 148 }
-1 149 });
-1 150 });
-1 151 return result;
-1 152 };
-1 153
-1 154 Element.prototype.mutate = function() {
-1 155 return this.shrink();
-1 156 };
-1 157
-1 158 Element.prototype.toString = function() {
-1 159 var s = '<' + this.tag + ' id="' + this.id + '"';
-1 160 this.attrs.value.forEach(function(attr) {
-1 161 s += ' ' + attr;
-1 162 });
-1 163 s += '>' + this.content;
-1 164 this.children.value.forEach(function(child) {
-1 165 s += child.toString();
-1 166 });
-1 167 s += '</' + this.tag + '>';
-1 168 return s;
-1 169 };
-1 170
-1 171 function Children(len, ctx) {
-1 172 this.value = [];
-1 173 for (var i = 0; i < len; i++) {
-1 174 this.value.push(new Element(randomInt(len), ctx));
-1 175 }
-1 176 }
-1 177
-1 178 Children.prototype.shrink = function() {
-1 179 var result = [];
-1 180 for (var i = 0; i < this.value.length; i++) {
-1 181 var item = new Children(0, {});
-1 182 for (var j = 0; j < this.value.length; j++) {
-1 183 if (j !== i) {
-1 184 // shortcut: pick random shrink result
-1 185 var shrunken = this.value[j].shrink();
-1 186 if (shrunken.length) {
-1 187 item.value.push(randomChoice(shrunken));
-1 188 }
-1 189 }
-1 190 }
-1 191 result.push(item);
-1 192 }
-1 193 return result;
-1 194 };
-1 195
-1 196 module.exports = {
-1 197 'Element': Element,
-1 198 };
-1 199
-1 200 },{"aria-api/lib/constants":5}],3:[function(require,module,exports){
-1 201 var ariaApi = require('aria-api/instrumented.js');
-1 202 var accdc = require('w3c-alternative-text-computation');
-1 203
-1 204 var fuzzer = require('./fuzzer');
-1 205 var html = require('./html');
-1 206
-1 207 var preview = document.querySelector('#ba-preview');
-1 208 var fingerprints = document.querySelector('#ba-fingerprints');
-1 209 var errors = document.querySelector('#ba-errors');
-1 210 var reports = document.querySelector('#ba-reports');
-1 211
-1 212 var oracle = function(input) {
-1 213 preview.innerHTML = input.toString();
-1 214 var el = preview.querySelector('#test') || preview.children[0] || preview;
-1 215 var v1, v2;
-1 216
-1 217 try {
-1 218 v1 = accdc.calcNames(el).name;
-1 219 } catch (error) {
-1 220 v1 = error;
-1 221 }
-1 222
-1 223 try {
-1 224 v2 = ariaApi.getName(el);
-1 225 } catch (error) {
-1 226 v2 = error;
-1 227 }
-1 228
-1 229 if (v1 !== v2) {
-1 230 return {
-1 231 'html': preview.innerHTML,
-1 232 'v1': v1,
-1 233 'v2': v2,
-1 234 };
-1 235 }
-1 236 };
-1 237
-1 238 var renderReport = function(report) {
-1 239 var tr = document.createElement('tr');
-1 240 var td1 = document.createElement('td');
-1 241 td1.textContent = report.html;
-1 242 tr.append(td1);
-1 243 var td2 = document.createElement('td');
-1 244 td2.textContent = report.v1;
-1 245 tr.append(td2);
-1 246 var td3 = document.createElement('td');
-1 247 td3.textContent = report.v2;
-1 248 tr.append(td3);
-1 249 return tr;
-1 250 };
-1 251
-1 252 document.addEventListener('DOMContentLoaded', function() {
-1 253 var covPath = 'node_modules/aria-api/lib/name.js';
-1 254 var corpus = [];
-1 255 for (var i = 0; i < 10; i++) {
-1 256 corpus.push(new html.Element(10));
-1 257 }
-1 258 fuzzer.run(corpus, oracle, covPath, function(fingerprint, c) {
-1 259 fingerprints.textContent = c;
-1 260 }, function(report) {
-1 261 reports.append(renderReport(report));
-1 262 errors.textContent = reports.children.length;
-1 263 }, function() {
-1 264 preview.innerHTML = 'DONE';
-1 265 });
-1 266 });
-1 267
-1 268 },{"./fuzzer":1,"./html":2,"aria-api/instrumented.js":4,"w3c-alternative-text-computation":9}],4:[function(require,module,exports){
-1 269 var query = require('./lib/query.js');
-1 270 var name = require('./lib/name-inst.js');
-1 271
-1 272 module.exports = {
-1 273 getRole: query.getRole,
-1 274 getAttribute: query.getAttribute,
-1 275 getName: name.getName,
-1 276 getDescription: name.getDescription,
-1 277
-1 278 matches: query.matches,
-1 279 querySelector: query.querySelector,
-1 280 querySelectorAll: query.querySelectorAll,
-1 281 closest: query.closest,
-1 282 };
-1 283
-1 284 },{"./lib/name-inst.js":6,"./lib/query.js":7}],5:[function(require,module,exports){
-1 285 exports.attributes = {
-1 286 // widget
-1 287 'autocomplete': 'token',
-1 288 'checked': 'tristate',
-1 289 'current': 'token',
-1 290 'disabled': 'bool',
-1 291 'expanded': 'bool-undefined',
-1 292 'haspopup': 'token',
-1 293 'hidden': 'bool', // !
-1 294 'invalid': 'token',
-1 295 'keyshortcuts': 'string',
-1 296 'label': 'string',
-1 297 'level': 'int',
-1 298 'modal': 'bool',
-1 299 'multiline': 'bool',
-1 300 'multiselectable': 'bool',
-1 301 'orientation': 'token',
-1 302 'placeholder': 'string',
-1 303 'pressed': 'tristate',
-1 304 'readonly': 'bool',
-1 305 'required': 'bool',
-1 306 'roledescription': 'string',
-1 307 'selected': 'bool-undefined',
-1 308 'valuemax': 'number',
-1 309 'valuemin': 'number',
-1 310 'valuenow': 'number',
-1 311 'valuetext': 'string',
-1 312
-1 313 // live
-1 314 'atomic': 'bool',
-1 315 'busy': 'bool',
-1 316 'live': 'token',
-1 317 'relevant': 'token-list',
-1 318
-1 319 // dragndrop
-1 320 'dropeffect': 'token-list',
-1 321 'grabbed': 'bool-undefined',
-1 322
-1 323 // relationship
-1 324 'activedescendant': 'id',
-1 325 'colcount': 'int',
-1 326 'colindex': 'int',
-1 327 'colspan': 'int',
-1 328 'controls': 'id-list',
-1 329 'describedby': 'id-list',
-1 330 'details': 'id',
-1 331 'errormessage': 'id',
-1 332 'flowto': 'id-list',
-1 333 'labelledby': 'id-list',
-1 334 'owns': 'id-list',
-1 335 'posinset': 'int',
-1 336 'rowcount': 'int',
-1 337 'rowindex': 'int',
-1 338 'rowspan': 'int',
-1 339 'setsize': 'int',
-1 340 'sort': 'token',
-1 341 };
-1 342
-1 343 exports.attributeStrongMapping = {
-1 344 'disabled': 'disabled',
-1 345 'hidden': 'hidden',
-1 346 'placeholder': 'placeholder',
-1 347 'readonly': 'readOnly',
-1 348 'required': 'required',
-1 349 };
-1 350
-1 351 exports.attributeWeakMapping = {
-1 352 'checked': 'checked',
-1 353 'colspan': 'colSpan',
-1 354 'expanded': 'open',
-1 355 'multiselectable': 'multiple',
-1 356 'rowspan': 'rowSpan',
-1 357 'selected': 'selected',
-1 358 };
-1 359
-1 360 // https://www.w3.org/TR/html-aria/#docconformance
-1 361 exports.extraSelectors = {
-1 362 article: ['article'],
-1 363 button: [
-1 364 'button',
-1 365 'input[type="button"]',
-1 366 'input[type="image"]',
-1 367 'input[type="reset"]',
-1 368 'input[type="submit"]',
-1 369 'summary',
-1 370 ],
-1 371 cell: ['td'],
-1 372 checkbox: ['input[type="checkbox"]'],
-1 373 combobox: [
-1 374 'input:not([type])[list]',
-1 375 'input[type="email"][list]',
-1 376 'input[type="search"][list]',
-1 377 'input[type="tel"][list]',
-1 378 'input[type="text"][list]',
-1 379 'input[type="url"][list]',
-1 380 'select:not([size]):not([multiple])',
-1 381 'select[size="0"]:not([multiple])',
-1 382 'select[size="1"]:not([multiple])',
-1 383 ],
-1 384 complementary: ['aside'],
-1 385 definition: ['dd'],
-1 386 dialog: ['dialog'],
-1 387 document: ['body'],
-1 388 figure: ['figure'],
-1 389 form: ['form[aria-label]', 'form[aria-labelledby]'],
-1 390 group: ['details', 'optgroup'],
-1 391 heading: ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'],
-1 392 img: ['img:not([alt=""])', 'graphics-symbol'],
-1 393 link: ['a[href]', 'area[href]', 'link[href]'],
-1 394 list: ['dl', 'ol', 'ul'],
-1 395 listbox: [
-1 396 'select[multiple]',
-1 397 'select[size]:not([size="0"]):not([size="1"])',
-1 398 ],
-1 399 listitem: ['dt', 'ul > li', 'ol > li'],
-1 400 main: ['main'],
-1 401 math: ['math'],
-1 402 menuitemcheckbox: ['menuitem[type="checkbox"]'],
-1 403 menuitem: ['menuitem[type="command"]'],
-1 404 menuitemradio: ['menuitem[type="radio"]'],
-1 405 menu: ['menu[type="context"]'],
-1 406 navigation: ['nav'],
-1 407 option: ['option'],
-1 408 progressbar: ['progress'],
-1 409 radio: ['input[type="radio"]'],
-1 410 region: ['section[aria-label]', 'section[aria-labelledby]', 'section[title]'],
-1 411 rowgroup: ['tbody', 'thead', 'tfoot'],
-1 412 row: ['tr'],
-1 413 searchbox: ['input[type="search"]:not([list])'],
-1 414 separator: ['hr'],
-1 415 slider: ['input[type="range"]'],
-1 416 spinbutton: ['input[type="number"]'],
-1 417 status: ['output'],
-1 418 table: ['table'],
-1 419 term: ['dfn', 'dt'],
-1 420 textbox: [
-1 421 'input:not([type]):not([list])',
-1 422 'input[type="email"]:not([list])',
-1 423 'input[type="tel"]:not([list])',
-1 424 'input[type="text"]:not([list])',
-1 425 'input[type="url"]:not([list])',
-1 426 'textarea',
-1 427 ],
-1 428
-1 429 // if scope is missing, it is calculated automatically
-1 430 rowheader: ['th[scope="row"]'],
-1 431 columnheader: ['th[scope="col"]'],
-1 432 };
-1 433
-1 434 exports.scoped = [
-1 435 'article *', 'aside *', 'main *', 'nav *', 'section *',
-1 436 ].join(',');
-1 437
-1 438 // https://www.w3.org/TR/wai-aria/roles
-1 439 var subRoles = {
-1 440 cell: ['gridcell', 'rowheader'],
-1 441 command: ['button', 'link', 'menuitem'],
-1 442 composite: ['grid', 'select', 'spinbutton', 'tablist'],
-1 443 img: ['doc-cover'],
-1 444 input: ['checkbox', 'option', 'radio', 'slider', 'spinbutton', 'textbox'],
-1 445 landmark: [
-1 446 'banner',
-1 447 'complementary',
-1 448 'contentinfo',
-1 449 'doc-acknowledgments',
-1 450 'doc-afterword',
-1 451 'doc-appendix',
-1 452 'doc-bibliography',
-1 453 'doc-chapter',
-1 454 'doc-conclusion',
-1 455 'doc-credits',
-1 456 'doc-endnotes',
-1 457 'doc-epilogue',
-1 458 'doc-errata',
-1 459 'doc-foreword',
-1 460 'doc-glossary',
-1 461 'doc-introduction',
-1 462 'doc-part',
-1 463 'doc-preface',
-1 464 'doc-prologue',
-1 465 'form',
-1 466 'main',
-1 467 'navigation',
-1 468 'region',
-1 469 'search',
-1 470 ],
-1 471 range: ['progressbar', 'scrollbar', 'slider', 'spinbutton'],
-1 472 roletype: ['structure', 'widget', 'window'],
-1 473 section: [
-1 474 'alert',
-1 475 'cell',
-1 476 'definition',
-1 477 'doc-abstract',
-1 478 'doc-colophon',
-1 479 'doc-credit',
-1 480 'doc-dedication',
-1 481 'doc-epigraph',
-1 482 'doc-example',
-1 483 'doc-footnote',
-1 484 'doc-qna',
-1 485 'figure',
-1 486 'group',
-1 487 'img',
-1 488 'landmark',
-1 489 'list',
-1 490 'listitem',
-1 491 'log',
-1 492 'marquee',
-1 493 'math',
-1 494 'note',
-1 495 'status',
-1 496 'table',
-1 497 'tabpanel',
-1 498 'term',
-1 499 'tooltip',
-1 500 ],
-1 501 sectionhead: [
-1 502 'columnheader',
-1 503 'doc-subtitle',
-1 504 'heading',
-1 505 'rowheader',
-1 506 'tab',
-1 507 ],
-1 508 select: ['combobox', 'listbox', 'menu', 'radiogroup', 'tree'],
-1 509 separator: ['doc-pagebreak'],
-1 510 structure: [
-1 511 'application',
-1 512 'document',
-1 513 'none',
-1 514 'presentation',
-1 515 'rowgroup',
-1 516 'section',
-1 517 'sectionhead',
-1 518 'separator',
-1 519 ],
-1 520 table: ['grid'],
-1 521 textbox: ['searchbox'],
-1 522 widget: [
-1 523 'command',
-1 524 'composite',
-1 525 'gridcell',
-1 526 'input',
-1 527 'range',
-1 528 'row',
-1 529 'separator',
-1 530 'tab',
-1 531 ],
-1 532 window: ['dialog'],
-1 533 alert: ['alertdialog'],
-1 534 checkbox: ['menuitemcheckbox', 'switch'],
-1 535 dialog: ['alertdialog'],
-1 536 gridcell: ['columnheader', 'rowheader'],
-1 537 menuitem: ['menuitemcheckbox'],
-1 538 menuitemcheckbox: ['menuitemradio'],
-1 539 option: ['treeitem'],
-1 540 radio: ['menuitemradio'],
-1 541 status: ['timer'],
-1 542 grid: ['treegrid'],
-1 543 menu: ['menubar'],
-1 544 tree: ['treegrid'],
-1 545 document: ['article', 'graphics-document'],
-1 546 group: ['row', 'select', 'toolbar', 'graphics-object'],
-1 547 link: ['doc-backlink', 'doc-biblioref', 'doc-glossref', 'doc-noteref'],
-1 548 list: ['directory', 'feed'],
-1 549 listitem: ['doc-biblioentry', 'doc-endnote', 'treeitem'],
-1 550 navigation: ['doc-index', 'doc-pagelist', 'doc-toc'],
-1 551 note: ['doc-notice', 'doc-tip'],
-1 552 };
-1 553
-1 554 var getSubRoles = function(role) {
-1 555 var children = subRoles[role] || [];
-1 556 var descendents = children.map(getSubRoles);
-1 557
-1 558 var result = [role];
-1 559
-1 560 descendents.forEach(function(list) {
-1 561 list.forEach(function(r) {
-1 562 if (result.indexOf(r) === -1) {
-1 563 result.push(r);
-1 564 }
-1 565 });
-1 566 });
-1 567
-1 568 return result;
-1 569 };
-1 570
-1 571 exports.subRoles = {};
-1 572 for (var role in subRoles) {
-1 573 exports.subRoles[role] = getSubRoles(role);
-1 574 }
-1 575 exports.subRoles['none'] = ['none', 'presentation'];
-1 576 exports.subRoles['presentation'] = ['presentation', 'none'];
-1 577
-1 578 exports.nameFromContents = [
-1 579 'button',
-1 580 'checkbox',
-1 581 'columnheader',
-1 582 'doc-backlink',
-1 583 'doc-biblioref',
-1 584 'doc-glossref',
-1 585 'doc-noteref',
-1 586 'gridcell',
-1 587 'heading',
-1 588 'link',
-1 589 'menuitem',
-1 590 'menuitemcheckbox',
-1 591 'menuitemradio',
-1 592 'option',
-1 593 'radio',
-1 594 'row',
-1 595 'rowgroup',
-1 596 'rowheader',
-1 597 'sectionhead',
-1 598 'tab',
-1 599 'tooltip',
-1 600 'treeitem',
-1 601 'switch',
-1 602 ];
-1 603
-1 604 exports.nameFromDescendant = {
-1 605 'figure': 'figcaption',
-1 606 'table': 'caption',
-1 607 'fieldset': 'legend',
-1 608 };
-1 609
-1 610 exports.nameDefaults = {
-1 611 '[type="submit"]': 'Submit',
-1 612 '[type="reset"]': 'Reset',
-1 613 'summary': 'Details',
-1 614 };
-1 615
-1 616 exports.labelable = [
-1 617 'button',
-1 618 'input:not([type="hidden"])',
-1 619 'keygen',
-1 620 'meter',
-1 621 'output',
-1 622 'progress',
-1 623 'select',
-1 624 'textarea',
-1 625 ];
-1 626
-1 627 },{}],6:[function(require,module,exports){
-1 628 var cov_2q245nv9x6=function(){var path="node_modules/aria-api/lib/name.js";var hash="fc6223e56d72c7c6323418f64093aae0a5c92ccd";var Function=function(){}.constructor;var global=new Function("return this")();var gcv="__coverage__";var coverageData={path:"node_modules/aria-api/lib/name.js",statementMap:{"0":{start:{line:1,column:16},end:{line:1,column:41}},"1":{start:{line:2,column:12},end:{line:2,column:33}},"2":{start:{line:3,column:11},end:{line:3,column:31}},"3":{start:{line:5,column:23},end:{line:21,column:1}},"4":{start:{line:6,column:14},end:{line:6,column:53}},"5":{start:{line:7,column:11},end:{line:7,column:45}},"6":{start:{line:8,column:14},end:{line:8,column:54}},"7":{start:{line:9,column:1},end:{line:11,column:2}},"8":{start:{line:10,column:2},end:{line:10,column:12}},"9":{start:{line:12,column:1},end:{line:20,column:2}},"10":{start:{line:13,column:2},end:{line:13,column:12}},"11":{start:{line:15,column:2},end:{line:19,column:3}},"12":{start:{line:16,column:3},end:{line:16,column:27}},"13":{start:{line:18,column:3},end:{line:18,column:39}},"14":{start:{line:23,column:17},end:{line:57,column:1}},"15":{start:{line:24,column:16},end:{line:24,column:18}},"16":{start:{line:26,column:1},end:{line:28,column:2}},"17":{start:{line:26,column:14},end:{line:26,column:15}},"18":{start:{line:27,column:2},end:{line:27,column:36}},"19":{start:{line:30,column:12},end:{line:30,column:50}},"20":{start:{line:31,column:1},end:{line:36,column:2}},"21":{start:{line:31,column:14},end:{line:31,column:15}},"22":{start:{line:32,column:14},end:{line:32,column:46}},"23":{start:{line:33,column:2},end:{line:35,column:3}},"24":{start:{line:34,column:3},end:{line:34,column:24}},"25":{start:{line:38,column:11},end:{line:38,column:13}},"26":{start:{line:39,column:1},end:{line:54,column:2}},"27":{start:{line:39,column:14},end:{line:39,column:15}},"28":{start:{line:40,column:13},end:{line:40,column:24}},"29":{start:{line:41,column:2},end:{line:53,column:3}},"30":{start:{line:42,column:3},end:{line:42,column:27}},"31":{start:{line:43,column:9},end:{line:53,column:3}},"32":{start:{line:44,column:3},end:{line:52,column:4}},"33":{start:{line:45,column:4},end:{line:45,column:16}},"34":{start:{line:46,column:10},end:{line:52,column:4}},"35":{start:{line:49,column:4},end:{line:49,column:43}},"36":{start:{line:51,column:4},end:{line:51,column:55}},"37":{start:{line:56,column:1},end:{line:56,column:12}},"38":{start:{line:59,column:27},end:{line:62,column:1}},"39":{start:{line:60,column:12},end:{line:60,column:29}},"40":{start:{line:61,column:1},end:{line:61,column:65}},"41":{start:{line:64,column:18},end:{line:67,column:1}},"42":{start:{line:65,column:16},end:{line:65,column:45}},"43":{start:{line:66,column:1},end:{line:66,column:29}},"44":{start:{line:70,column:20},end:{line:85,column:1}},"45":{start:{line:71,column:14},end:{line:71,column:16}},"46":{start:{line:72,column:17},end:{line:72,column:46}},"47":{start:{line:73,column:1},end:{line:83,column:4}},"48":{start:{line:74,column:2},end:{line:82,column:3}},"49":{start:{line:75,column:3},end:{line:81,column:4}},"50":{start:{line:76,column:4},end:{line:78,column:5}},"51":{start:{line:77,column:5},end:{line:77,column:23}},"52":{start:{line:79,column:10},end:{line:81,column:4}},"53":{start:{line:80,column:4},end:{line:80,column:22}},"54":{start:{line:84,column:1},end:{line:84,column:15}},"55":{start:{line:89,column:14},end:{line:165,column:1}},"56":{start:{line:90,column:11},end:{line:90,column:13}},"57":{start:{line:92,column:1},end:{line:94,column:2}},"58":{start:{line:93,column:2},end:{line:93,column:12}},"59":{start:{line:95,column:1},end:{line:102,column:2}},"60":{start:{line:96,column:12},end:{line:96,column:59}},"61":{start:{line:97,column:16},end:{line:100,column:4}},"62":{start:{line:98,column:15},end:{line:98,column:42}},"63":{start:{line:99,column:3},end:{line:99,column:51}},"64":{start:{line:101,column:2},end:{line:101,column:26}},"65":{start:{line:103,column:1},end:{line:105,column:2}},"66":{start:{line:104,column:2},end:{line:104,column:38}},"67":{start:{line:106,column:1},end:{line:108,column:2}},"68":{start:{line:107,column:2},end:{line:107,column:36}},"69":{start:{line:109,column:1},end:{line:114,column:2}},"70":{start:{line:110,column:16},end:{line:112,column:4}},"71":{start:{line:111,column:3},end:{line:111,column:38}},"72":{start:{line:113,column:2},end:{line:113,column:26}},"73":{start:{line:115,column:1},end:{line:117,column:2}},"74":{start:{line:116,column:2},end:{line:116,column:45}},"75":{start:{line:118,column:1},end:{line:120,column:2}},"76":{start:{line:119,column:2},end:{line:119,column:37}},"77":{start:{line:121,column:1},end:{line:123,column:2}},"78":{start:{line:122,column:2},end:{line:122,column:17}},"79":{start:{line:124,column:1},end:{line:133,column:2}},"80":{start:{line:125,column:2},end:{line:132,column:3}},"81":{start:{line:126,column:3},end:{line:131,column:4}},"82":{start:{line:127,column:21},end:{line:127,column:77}},"83":{start:{line:128,column:4},end:{line:130,column:5}},"84":{start:{line:129,column:5},end:{line:129,column:49}},"85":{start:{line:134,column:1},end:{line:147,column:2}},"86":{start:{line:135,column:2},end:{line:146,column:3}},"87":{start:{line:136,column:3},end:{line:145,column:4}},"88":{start:{line:137,column:4},end:{line:137,column:37}},"89":{start:{line:138,column:10},end:{line:145,column:4}},"90":{start:{line:139,column:19},end:{line:139,column:92}},"91":{start:{line:140,column:4},end:{line:142,column:5}},"92":{start:{line:141,column:5},end:{line:141,column:52}},"93":{start:{line:143,column:10},end:{line:145,column:4}},"94":{start:{line:144,column:4},end:{line:144,column:103}},"95":{start:{line:148,column:1},end:{line:150,column:2}},"96":{start:{line:149,column:2},end:{line:149,column:35}},"97":{start:{line:151,column:1},end:{line:157,column:2}},"98":{start:{line:152,column:2},end:{line:156,column:3}},"99":{start:{line:153,column:3},end:{line:155,column:4}},"100":{start:{line:154,column:4},end:{line:154,column:43}},"101":{start:{line:158,column:1},end:{line:160,column:2}},"102":{start:{line:159,column:2},end:{line:159,column:23}},"103":{start:{line:162,column:14},end:{line:162,column:45}},"104":{start:{line:163,column:13},end:{line:163,column:43}},"105":{start:{line:164,column:1},end:{line:164,column:29}},"106":{start:{line:167,column:21},end:{line:169,column:1}},"107":{start:{line:168,column:1},end:{line:168,column:48}},"108":{start:{line:171,column:21},end:{line:194,column:1}},"109":{start:{line:172,column:11},end:{line:172,column:13}},"110":{start:{line:174,column:1},end:{line:185,column:2}},"111":{start:{line:175,column:12},end:{line:175,column:60}},"112":{start:{line:176,column:16},end:{line:179,column:4}},"113":{start:{line:177,column:15},end:{line:177,column:42}},"114":{start:{line:178,column:3},end:{line:178,column:51}},"115":{start:{line:180,column:2},end:{line:180,column:26}},"116":{start:{line:181,column:8},end:{line:185,column:2}},"117":{start:{line:182,column:2},end:{line:182,column:17}},"118":{start:{line:183,column:8},end:{line:185,column:2}},"119":{start:{line:184,column:2},end:{line:184,column:23}},"120":{start:{line:187,column:1},end:{line:187,column:47}},"121":{start:{line:189,column:1},end:{line:191,column:2}},"122":{start:{line:190,column:2},end:{line:190,column:11}},"123":{start:{line:193,column:1},end:{line:193,column:12}},"124":{start:{line:196,column:0},end:{line:199,column:2}}},fnMap:{"0":{name:"(anonymous_0)",decl:{start:{line:5,column:23},end:{line:5,column:24}},loc:{start:{line:5,column:48},end:{line:21,column:1}},line:5},"1":{name:"(anonymous_1)",decl:{start:{line:23,column:17},end:{line:23,column:18}},loc:{start:{line:23,column:44},end:{line:57,column:1}},line:23},"2":{name:"(anonymous_2)",decl:{start:{line:59,column:27},end:{line:59,column:28}},loc:{start:{line:59,column:40},end:{line:62,column:1}},line:59},"3":{name:"(anonymous_3)",decl:{start:{line:64,column:18},end:{line:64,column:19}},loc:{start:{line:64,column:31},end:{line:67,column:1}},line:64},"4":{name:"(anonymous_4)",decl:{start:{line:70,column:20},end:{line:70,column:21}},loc:{start:{line:70,column:38},end:{line:85,column:1}},line:70},"5":{name:"(anonymous_5)",decl:{start:{line:73,column:29},end:{line:73,column:30}},loc:{start:{line:73,column:44},end:{line:83,column:2}},line:73},"6":{name:"(anonymous_6)",decl:{start:{line:89,column:14},end:{line:89,column:15}},loc:{start:{line:89,column:50},end:{line:165,column:1}},line:89},"7":{name:"(anonymous_7)",decl:{start:{line:97,column:24},end:{line:97,column:25}},loc:{start:{line:97,column:37},end:{line:100,column:3}},line:97},"8":{name:"(anonymous_8)",decl:{start:{line:110,column:38},end:{line:110,column:39}},loc:{start:{line:110,column:54},end:{line:112,column:3}},line:110},"9":{name:"(anonymous_9)",decl:{start:{line:167,column:21},end:{line:167,column:22}},loc:{start:{line:167,column:34},end:{line:169,column:1}},line:167},"10":{name:"(anonymous_10)",decl:{start:{line:171,column:21},end:{line:171,column:22}},loc:{start:{line:171,column:34},end:{line:194,column:1}},line:171},"11":{name:"(anonymous_11)",decl:{start:{line:176,column:24},end:{line:176,column:25}},loc:{start:{line:176,column:37},end:{line:179,column:3}},line:176}},branchMap:{"0":{loc:{start:{line:9,column:1},end:{line:11,column:2}},type:"if",locations:[{start:{line:9,column:1},end:{line:11,column:2}},{start:{line:9,column:1},end:{line:11,column:2}}],line:9},"1":{loc:{start:{line:12,column:1},end:{line:20,column:2}},type:"if",locations:[{start:{line:12,column:1},end:{line:20,column:2}},{start:{line:12,column:1},end:{line:20,column:2}}],line:12},"2":{loc:{start:{line:15,column:2},end:{line:19,column:3}},type:"if",locations:[{start:{line:15,column:2},end:{line:19,column:3}},{start:{line:15,column:2},end:{line:19,column:3}}],line:15},"3":{loc:{start:{line:30,column:12},end:{line:30,column:50}},type:"binary-expr",locations:[{start:{line:30,column:12},end:{line:30,column:44}},{start:{line:30,column:48},end:{line:30,column:50}}],line:30},"4":{loc:{start:{line:33,column:2},end:{line:35,column:3}},type:"if",locations:[{start:{line:33,column:2},end:{line:35,column:3}},{start:{line:33,column:2},end:{line:35,column:3}}],line:33},"5":{loc:{start:{line:41,column:2},end:{line:53,column:3}},type:"if",locations:[{start:{line:41,column:2},end:{line:53,column:3}},{start:{line:41,column:2},end:{line:53,column:3}}],line:41},"6":{loc:{start:{line:43,column:9},end:{line:53,column:3}},type:"if",locations:[{start:{line:43,column:9},end:{line:53,column:3}},{start:{line:43,column:9},end:{line:53,column:3}}],line:43},"7":{loc:{start:{line:44,column:3},end:{line:52,column:4}},type:"if",locations:[{start:{line:44,column:3},end:{line:52,column:4}},{start:{line:44,column:3},end:{line:52,column:4}}],line:44},"8":{loc:{start:{line:46,column:10},end:{line:52,column:4}},type:"if",locations:[{start:{line:46,column:10},end:{line:52,column:4}},{start:{line:46,column:10},end:{line:52,column:4}}],line:46},"9":{loc:{start:{line:46,column:14},end:{line:48,column:41}},type:"binary-expr",locations:[{start:{line:46,column:14},end:{line:46,column:77}},{start:{line:47,column:5},end:{line:47,column:43}},{start:{line:48,column:5},end:{line:48,column:41}}],line:46},"10":{loc:{start:{line:61,column:8},end:{line:61,column:64}},type:"binary-expr",locations:[{start:{line:61,column:8},end:{line:61,column:13}},{start:{line:61,column:17},end:{line:61,column:64}}],line:61},"11":{loc:{start:{line:74,column:2},end:{line:82,column:3}},type:"if",locations:[{start:{line:74,column:2},end:{line:82,column:3}},{start:{line:74,column:2},end:{line:82,column:3}}],line:74},"12":{loc:{start:{line:74,column:6},end:{line:74,column:60}},type:"binary-expr",locations:[{start:{line:74,column:6},end:{line:74,column:18}},{start:{line:74,column:22},end:{line:74,column:60}}],line:74},"13":{loc:{start:{line:75,column:3},end:{line:81,column:4}},type:"if",locations:[{start:{line:75,column:3},end:{line:81,column:4}},{start:{line:75,column:3},end:{line:81,column:4}}],line:75},"14":{loc:{start:{line:76,column:4},end:{line:78,column:5}},type:"if",locations:[{start:{line:76,column:4},end:{line:78,column:5}},{start:{line:76,column:4},end:{line:78,column:5}}],line:76},"15":{loc:{start:{line:76,column:8},end:{line:76,column:61}},type:"binary-expr",locations:[{start:{line:76,column:8},end:{line:76,column:18}},{start:{line:76,column:22},end:{line:76,column:61}}],line:76},"16":{loc:{start:{line:79,column:10},end:{line:81,column:4}},type:"if",locations:[{start:{line:79,column:10},end:{line:81,column:4}},{start:{line:79,column:10},end:{line:81,column:4}}],line:79},"17":{loc:{start:{line:92,column:1},end:{line:94,column:2}},type:"if",locations:[{start:{line:92,column:1},end:{line:94,column:2}},{start:{line:92,column:1},end:{line:94,column:2}}],line:92},"18":{loc:{start:{line:95,column:1},end:{line:102,column:2}},type:"if",locations:[{start:{line:95,column:1},end:{line:102,column:2}},{start:{line:95,column:1},end:{line:102,column:2}}],line:95},"19":{loc:{start:{line:95,column:5},end:{line:95,column:50}},type:"binary-expr",locations:[{start:{line:95,column:5},end:{line:95,column:15}},{start:{line:95,column:19},end:{line:95,column:50}}],line:95},"20":{loc:{start:{line:99,column:10},end:{line:99,column:50}},type:"cond-expr",locations:[{start:{line:99,column:18},end:{line:99,column:45}},{start:{line:99,column:48},end:{line:99,column:50}}],line:99},"21":{loc:{start:{line:103,column:1},end:{line:105,column:2}},type:"if",locations:[{start:{line:103,column:1},end:{line:105,column:2}},{start:{line:103,column:1},end:{line:105,column:2}}],line:103},"22":{loc:{start:{line:103,column:5},end:{line:103,column:46}},type:"binary-expr",locations:[{start:{line:103,column:5},end:{line:103,column:16}},{start:{line:103,column:20},end:{line:103,column:46}}],line:103},"23":{loc:{start:{line:106,column:1},end:{line:108,column:2}},type:"if",locations:[{start:{line:106,column:1},end:{line:108,column:2}},{start:{line:106,column:1},end:{line:108,column:2}}],line:106},"24":{loc:{start:{line:106,column:5},end:{line:106,column:53}},type:"binary-expr",locations:[{start:{line:106,column:5},end:{line:106,column:16}},{start:{line:106,column:20},end:{line:106,column:53}}],line:106},"25":{loc:{start:{line:109,column:1},end:{line:114,column:2}},type:"if",locations:[{start:{line:109,column:1},end:{line:114,column:2}},{start:{line:109,column:1},end:{line:114,column:2}}],line:109},"26":{loc:{start:{line:109,column:5},end:{line:109,column:42}},type:"binary-expr",locations:[{start:{line:109,column:5},end:{line:109,column:9}},{start:{line:109,column:13},end:{line:109,column:23}},{start:{line:109,column:27},end:{line:109,column:42}}],line:109},"27":{loc:{start:{line:115,column:1},end:{line:117,column:2}},type:"if",locations:[{start:{line:115,column:1},end:{line:117,column:2}},{start:{line:115,column:1},end:{line:117,column:2}}],line:115},"28":{loc:{start:{line:116,column:8},end:{line:116,column:44}},type:"binary-expr",locations:[{start:{line:116,column:8},end:{line:116,column:38}},{start:{line:116,column:42},end:{line:116,column:44}}],line:116},"29":{loc:{start:{line:118,column:1},end:{line:120,column:2}},type:"if",locations:[{start:{line:118,column:1},end:{line:120,column:2}},{start:{line:118,column:1},end:{line:120,column:2}}],line:118},"30":{loc:{start:{line:119,column:8},end:{line:119,column:36}},type:"binary-expr",locations:[{start:{line:119,column:8},end:{line:119,column:30}},{start:{line:119,column:34},end:{line:119,column:36}}],line:119},"31":{loc:{start:{line:121,column:1},end:{line:123,column:2}},type:"if",locations:[{start:{line:121,column:1},end:{line:123,column:2}},{start:{line:121,column:1},end:{line:123,column:2}}],line:121},"32":{loc:{start:{line:121,column:5},end:{line:121,column:58}},type:"binary-expr",locations:[{start:{line:121,column:5},end:{line:121,column:16}},{start:{line:121,column:20},end:{line:121,column:46}},{start:{line:121,column:50},end:{line:121,column:58}}],line:121},"33":{loc:{start:{line:124,column:1},end:{line:133,column:2}},type:"if",locations:[{start:{line:124,column:1},end:{line:133,column:2}},{start:{line:124,column:1},end:{line:133,column:2}}],line:124},"34":{loc:{start:{line:126,column:3},end:{line:131,column:4}},type:"if",locations:[{start:{line:126,column:3},end:{line:131,column:4}},{start:{line:126,column:3},end:{line:131,column:4}}],line:126},"35":{loc:{start:{line:128,column:4},end:{line:130,column:5}},type:"if",locations:[{start:{line:128,column:4},end:{line:130,column:5}},{start:{line:128,column:4},end:{line:130,column:5}}],line:128},"36":{loc:{start:{line:134,column:1},end:{line:147,column:2}},type:"if",locations:[{start:{line:134,column:1},end:{line:147,column:2}},{start:{line:134,column:1},end:{line:147,column:2}}],line:134},"37":{loc:{start:{line:134,column:5},end:{line:134,column:68}},type:"binary-expr",locations:[{start:{line:134,column:5},end:{line:134,column:24}},{start:{line:134,column:28},end:{line:134,column:37}},{start:{line:134,column:41},end:{line:134,column:68}}],line:134},"38":{loc:{start:{line:135,column:2},end:{line:146,column:3}},type:"if",locations:[{start:{line:135,column:2},end:{line:146,column:3}},{start:{line:135,column:2},end:{line:146,column:3}}],line:135},"39":{loc:{start:{line:135,column:6},end:{line:135,column:79}},type:"binary-expr",locations:[{start:{line:135,column:6},end:{line:135,column:17}},{start:{line:135,column:21},end:{line:135,column:79}}],line:135},"40":{loc:{start:{line:136,column:3},end:{line:145,column:4}},type:"if",locations:[{start:{line:136,column:3},end:{line:145,column:4}},{start:{line:136,column:3},end:{line:145,column:4}}],line:136},"41":{loc:{start:{line:137,column:10},end:{line:137,column:36}},type:"binary-expr",locations:[{start:{line:137,column:10},end:{line:137,column:18}},{start:{line:137,column:22},end:{line:137,column:36}}],line:137},"42":{loc:{start:{line:138,column:10},end:{line:145,column:4}},type:"if",locations:[{start:{line:138,column:10},end:{line:145,column:4}},{start:{line:138,column:10},end:{line:145,column:4}}],line:138},"43":{loc:{start:{line:139,column:19},end:{line:139,column:92}},type:"binary-expr",locations:[{start:{line:139,column:19},end:{line:139,column:55}},{start:{line:139,column:59},end:{line:139,column:92}}],line:139},"44":{loc:{start:{line:140,column:4},end:{line:142,column:5}},type:"if",locations:[{start:{line:140,column:4},end:{line:142,column:5}},{start:{line:140,column:4},end:{line:142,column:5}}],line:140},"45":{loc:{start:{line:143,column:10},end:{line:145,column:4}},type:"if",locations:[{start:{line:143,column:10},end:{line:145,column:4}},{start:{line:143,column:10},end:{line:145,column:4}}],line:143},"46":{loc:{start:{line:144,column:16},end:{line:144,column:101}},type:"binary-expr",locations:[{start:{line:144,column:16},end:{line:144,column:51}},{start:{line:144,column:55},end:{line:144,column:89}},{start:{line:144,column:93},end:{line:144,column:101}}],line:144},"47":{loc:{start:{line:148,column:1},end:{line:150,column:2}},type:"if",locations:[{start:{line:148,column:1},end:{line:150,column:2}},{start:{line:148,column:1},end:{line:150,column:2}}],line:148},"48":{loc:{start:{line:148,column:5},end:{line:148,column:89}},type:"binary-expr",locations:[{start:{line:148,column:5},end:{line:148,column:16}},{start:{line:148,column:21},end:{line:148,column:30}},{start:{line:148,column:34},end:{line:148,column:58}},{start:{line:148,column:63},end:{line:148,column:89}}],line:148},"49":{loc:{start:{line:151,column:1},end:{line:157,column:2}},type:"if",locations:[{start:{line:151,column:1},end:{line:157,column:2}},{start:{line:151,column:1},end:{line:157,column:2}}],line:151},"50":{loc:{start:{line:153,column:3},end:{line:155,column:4}},type:"if",locations:[{start:{line:153,column:3},end:{line:155,column:4}},{start:{line:153,column:3},end:{line:155,column:4}}],line:153},"51":{loc:{start:{line:158,column:1},end:{line:160,column:2}},type:"if",locations:[{start:{line:158,column:1},end:{line:160,column:2}},{start:{line:158,column:1},end:{line:160,column:2}}],line:158},"52":{loc:{start:{line:159,column:8},end:{line:159,column:22}},type:"binary-expr",locations:[{start:{line:159,column:8},end:{line:159,column:16}},{start:{line:159,column:20},end:{line:159,column:22}}],line:159},"53":{loc:{start:{line:174,column:1},end:{line:185,column:2}},type:"if",locations:[{start:{line:174,column:1},end:{line:185,column:2}},{start:{line:174,column:1},end:{line:185,column:2}}],line:174},"54":{loc:{start:{line:178,column:10},end:{line:178,column:50}},type:"cond-expr",locations:[{start:{line:178,column:18},end:{line:178,column:45}},{start:{line:178,column:48},end:{line:178,column:50}}],line:178},"55":{loc:{start:{line:181,column:8},end:{line:185,column:2}},type:"if",locations:[{start:{line:181,column:8},end:{line:185,column:2}},{start:{line:181,column:8},end:{line:185,column:2}}],line:181},"56":{loc:{start:{line:183,column:8},end:{line:185,column:2}},type:"if",locations:[{start:{line:183,column:8},end:{line:185,column:2}},{start:{line:183,column:8},end:{line:185,column:2}}],line:183},"57":{loc:{start:{line:187,column:8},end:{line:187,column:17}},type:"binary-expr",locations:[{start:{line:187,column:8},end:{line:187,column:11}},{start:{line:187,column:15},end:{line:187,column:17}}],line:187},"58":{loc:{start:{line:189,column:1},end:{line:191,column:2}},type:"if",locations:[{start:{line:189,column:1},end:{line:191,column:2}},{start:{line:189,column:1},end:{line:191,column:2}}],line:189}},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},f:{"0":0,"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":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,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,0],"27":[0,0],"28":[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],"37":[0,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,0],"47":[0,0],"48":[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],"56":[0,0],"57":[0,0],"58":[0,0]},_coverageSchema:"43e27e138ebf9cfc5966b082cf9a028302ed4184"};var coverage=global[gcv]||(global[gcv]={});if(coverage[path]&&coverage[path].hash===hash){return coverage[path];}coverageData.hash=hash;return coverage[path]=coverageData;}();var constants=(cov_2q245nv9x6.s[0]++,require('./constants.js'));var query=(cov_2q245nv9x6.s[1]++,require('./query.js'));var util=(cov_2q245nv9x6.s[2]++,require('./util.js'));cov_2q245nv9x6.s[3]++;var getPseudoContent=function(node,selector){cov_2q245nv9x6.f[0]++;var styles=(cov_2q245nv9x6.s[4]++,window.getComputedStyle(node,selector));var ret=(cov_2q245nv9x6.s[5]++,styles.getPropertyValue('content'));var inline=(cov_2q245nv9x6.s[6]++,styles.display.substr(0,6)==='inline');cov_2q245nv9x6.s[7]++;if(!ret){cov_2q245nv9x6.b[0][0]++;cov_2q245nv9x6.s[8]++;return'';}else{cov_2q245nv9x6.b[0][1]++;}cov_2q245nv9x6.s[9]++;if(ret.substr(0,1)!=='"'){cov_2q245nv9x6.b[1][0]++;cov_2q245nv9x6.s[10]++;return'';}else{cov_2q245nv9x6.b[1][1]++;cov_2q245nv9x6.s[11]++;if(inline){cov_2q245nv9x6.b[2][0]++;cov_2q245nv9x6.s[12]++;return ret.slice(1,-1);}else{cov_2q245nv9x6.b[2][1]++;cov_2q245nv9x6.s[13]++;return' '+ret.slice(1,-1)+' ';}}};cov_2q245nv9x6.s[14]++;var getContent=function(root,referenced){cov_2q245nv9x6.f[1]++;var children=(cov_2q245nv9x6.s[15]++,[]);cov_2q245nv9x6.s[16]++;for(var i=(cov_2q245nv9x6.s[17]++,0);i<root.childNodes.length;i++){cov_2q245nv9x6.s[18]++;children.push(root.childNodes[i]);}var owns=(cov_2q245nv9x6.s[19]++,(cov_2q245nv9x6.b[3][0]++,query.getAttribute(root,'owns'))||(cov_2q245nv9x6.b[3][1]++,[]));cov_2q245nv9x6.s[20]++;for(var i=(cov_2q245nv9x6.s[21]++,0);i<owns.length;i++){var owned=(cov_2q245nv9x6.s[22]++,document.getElementById(owns[i]));cov_2q245nv9x6.s[23]++;if(owned){cov_2q245nv9x6.b[4][0]++;cov_2q245nv9x6.s[24]++;children.push(owned);}else{cov_2q245nv9x6.b[4][1]++;}}var ret=(cov_2q245nv9x6.s[25]++,'');cov_2q245nv9x6.s[26]++;for(var i=(cov_2q245nv9x6.s[27]++,0);i<children.length;i++){var node=(cov_2q245nv9x6.s[28]++,children[i]);cov_2q245nv9x6.s[29]++;if(node.nodeType===node.TEXT_NODE){cov_2q245nv9x6.b[5][0]++;cov_2q245nv9x6.s[30]++;ret+=node.textContent;}else{cov_2q245nv9x6.b[5][1]++;cov_2q245nv9x6.s[31]++;if(node.nodeType===node.ELEMENT_NODE){cov_2q245nv9x6.b[6][0]++;cov_2q245nv9x6.s[32]++;if(node.tagName.toLowerCase()==='br'){cov_2q245nv9x6.b[7][0]++;cov_2q245nv9x6.s[33]++;ret+='\n';}else{cov_2q245nv9x6.b[7][1]++;cov_2q245nv9x6.s[34]++;if((cov_2q245nv9x6.b[9][0]++,window.getComputedStyle(node).display.substr(0,6)==='inline')&&(cov_2q245nv9x6.b[9][1]++,node.tagName.toLowerCase()!=='input')&&(cov_2q245nv9x6.b[9][2]++,node.tagName.toLowerCase()!=='img')){cov_2q245nv9x6.b[8][0]++;cov_2q245nv9x6.s[35]++;// https://github.com/w3c/accname/issues/3
-1 629 ret+=getName(node,true,referenced);}else{cov_2q245nv9x6.b[8][1]++;cov_2q245nv9x6.s[36]++;ret+=' '+getName(node,true,referenced)+' ';}}}else{cov_2q245nv9x6.b[6][1]++;}}}cov_2q245nv9x6.s[37]++;return ret;};cov_2q245nv9x6.s[38]++;var allowNameFromContent=function(el){cov_2q245nv9x6.f[2]++;var role=(cov_2q245nv9x6.s[39]++,query.getRole(el));cov_2q245nv9x6.s[40]++;return(cov_2q245nv9x6.b[10][0]++,!role)||(cov_2q245nv9x6.b[10][1]++,constants.nameFromContents.indexOf(role)!==-1);};cov_2q245nv9x6.s[41]++;var isLabelable=function(el){cov_2q245nv9x6.f[3]++;var selector=(cov_2q245nv9x6.s[42]++,constants.labelable.join(','));cov_2q245nv9x6.s[43]++;return el.matches(selector);};// Control.labels is part of the standard, but not supported in most browsers
-1 630 cov_2q245nv9x6.s[44]++;var getLabelNodes=function(element){cov_2q245nv9x6.f[4]++;var labels=(cov_2q245nv9x6.s[45]++,[]);var labelable=(cov_2q245nv9x6.s[46]++,constants.labelable.join(','));cov_2q245nv9x6.s[47]++;util.walkDOM(document.body,function(node){cov_2q245nv9x6.f[5]++;cov_2q245nv9x6.s[48]++;if((cov_2q245nv9x6.b[12][0]++,node.tagName)&&(cov_2q245nv9x6.b[12][1]++,node.tagName.toLowerCase()==='label')){cov_2q245nv9x6.b[11][0]++;cov_2q245nv9x6.s[49]++;if(node.getAttribute('for')){cov_2q245nv9x6.b[13][0]++;cov_2q245nv9x6.s[50]++;if((cov_2q245nv9x6.b[15][0]++,element.id)&&(cov_2q245nv9x6.b[15][1]++,node.getAttribute('for')===element.id)){cov_2q245nv9x6.b[14][0]++;cov_2q245nv9x6.s[51]++;labels.push(node);}else{cov_2q245nv9x6.b[14][1]++;}}else{cov_2q245nv9x6.b[13][1]++;cov_2q245nv9x6.s[52]++;if(node.querySelector(labelable)===element){cov_2q245nv9x6.b[16][0]++;cov_2q245nv9x6.s[53]++;labels.push(node);}else{cov_2q245nv9x6.b[16][1]++;}}}else{cov_2q245nv9x6.b[11][1]++;}});cov_2q245nv9x6.s[54]++;return labels;};// http://www.ssbbartgroup.com/blog/how-the-w3c-text-alternative-computation-works/
-1 631 // https://www.w3.org/TR/accname-aam-1.1/#h-mapping_additional_nd_te
-1 632 cov_2q245nv9x6.s[55]++;var getName=function(el,recursive,referenced){cov_2q245nv9x6.f[6]++;var ret=(cov_2q245nv9x6.s[56]++,'');cov_2q245nv9x6.s[57]++;if(query.getAttribute(el,'hidden',referenced)){cov_2q245nv9x6.b[17][0]++;cov_2q245nv9x6.s[58]++;return'';}else{cov_2q245nv9x6.b[17][1]++;}cov_2q245nv9x6.s[59]++;if((cov_2q245nv9x6.b[19][0]++,!recursive)&&(cov_2q245nv9x6.b[19][1]++,el.matches('[aria-labelledby]'))){cov_2q245nv9x6.b[18][0]++;var ids=(cov_2q245nv9x6.s[60]++,el.getAttribute('aria-labelledby').split(/\s+/));var strings=(cov_2q245nv9x6.s[61]++,ids.map(function(id){cov_2q245nv9x6.f[7]++;var label=(cov_2q245nv9x6.s[62]++,document.getElementById(id));cov_2q245nv9x6.s[63]++;return label?(cov_2q245nv9x6.b[20][0]++,getName(label,true,label)):(cov_2q245nv9x6.b[20][1]++,'');}));cov_2q245nv9x6.s[64]++;ret=strings.join(' ');}else{cov_2q245nv9x6.b[18][1]++;}cov_2q245nv9x6.s[65]++;if((cov_2q245nv9x6.b[22][0]++,!ret.trim())&&(cov_2q245nv9x6.b[22][1]++,el.matches('[aria-label]'))){cov_2q245nv9x6.b[21][0]++;cov_2q245nv9x6.s[66]++;ret=el.getAttribute('aria-label');}else{cov_2q245nv9x6.b[21][1]++;}cov_2q245nv9x6.s[67]++;if((cov_2q245nv9x6.b[24][0]++,!ret.trim())&&(cov_2q245nv9x6.b[24][1]++,query.matches(el,'presentation'))){cov_2q245nv9x6.b[23][0]++;cov_2q245nv9x6.s[68]++;return getContent(el,referenced);}else{cov_2q245nv9x6.b[23][1]++;}cov_2q245nv9x6.s[69]++;if((cov_2q245nv9x6.b[26][0]++,!ret)&&(cov_2q245nv9x6.b[26][1]++,!recursive)&&(cov_2q245nv9x6.b[26][2]++,isLabelable(el))){cov_2q245nv9x6.b[25][0]++;var strings=(cov_2q245nv9x6.s[70]++,getLabelNodes(el).map(function(label){cov_2q245nv9x6.f[8]++;cov_2q245nv9x6.s[71]++;return getName(label,true,label);}));cov_2q245nv9x6.s[72]++;ret=strings.join(' ');}else{cov_2q245nv9x6.b[25][1]++;}cov_2q245nv9x6.s[73]++;if(!ret.trim()){cov_2q245nv9x6.b[27][0]++;cov_2q245nv9x6.s[74]++;ret=(cov_2q245nv9x6.b[28][0]++,el.getAttribute('placeholder'))||(cov_2q245nv9x6.b[28][1]++,'');}else{cov_2q245nv9x6.b[27][1]++;}cov_2q245nv9x6.s[75]++;if(!ret.trim()){cov_2q245nv9x6.b[29][0]++;cov_2q245nv9x6.s[76]++;ret=(cov_2q245nv9x6.b[30][0]++,el.getAttribute('alt'))||(cov_2q245nv9x6.b[30][1]++,'');}else{cov_2q245nv9x6.b[29][1]++;}cov_2q245nv9x6.s[77]++;if((cov_2q245nv9x6.b[32][0]++,!ret.trim())&&(cov_2q245nv9x6.b[32][1]++,el.matches('abbr,acronym'))&&(cov_2q245nv9x6.b[32][2]++,el.title)){cov_2q245nv9x6.b[31][0]++;cov_2q245nv9x6.s[78]++;ret=el.title;}else{cov_2q245nv9x6.b[31][1]++;}cov_2q245nv9x6.s[79]++;if(!ret.trim()){cov_2q245nv9x6.b[33][0]++;cov_2q245nv9x6.s[80]++;for(var selector in constants.nameFromDescendant){cov_2q245nv9x6.s[81]++;if(el.matches(selector)){cov_2q245nv9x6.b[34][0]++;var descendant=(cov_2q245nv9x6.s[82]++,el.querySelector(constants.nameFromDescendant[selector]));cov_2q245nv9x6.s[83]++;if(descendant){cov_2q245nv9x6.b[35][0]++;cov_2q245nv9x6.s[84]++;ret=getName(descendant,true,descendant);}else{cov_2q245nv9x6.b[35][1]++;}}else{cov_2q245nv9x6.b[34][1]++;}}}else{cov_2q245nv9x6.b[33][1]++;}cov_2q245nv9x6.s[85]++;if((cov_2q245nv9x6.b[37][0]++,el.closest('label'))||(cov_2q245nv9x6.b[37][1]++,recursive)||(cov_2q245nv9x6.b[37][2]++,query.matches(el,'button'))){cov_2q245nv9x6.b[36][0]++;cov_2q245nv9x6.s[86]++;if((cov_2q245nv9x6.b[39][0]++,!ret.trim())&&(cov_2q245nv9x6.b[39][1]++,query.matches(el,'textbox,button,combobox,listbox,range'))){cov_2q245nv9x6.b[38][0]++;cov_2q245nv9x6.s[87]++;if(query.matches(el,'textbox,button')){cov_2q245nv9x6.b[40][0]++;cov_2q245nv9x6.s[88]++;ret=(cov_2q245nv9x6.b[41][0]++,el.value)||(cov_2q245nv9x6.b[41][1]++,el.textContent);}else{cov_2q245nv9x6.b[40][1]++;cov_2q245nv9x6.s[89]++;if(query.matches(el,'combobox,listbox')){cov_2q245nv9x6.b[42][0]++;var selected=(cov_2q245nv9x6.s[90]++,(cov_2q245nv9x6.b[43][0]++,query.querySelector(el,':selected'))||(cov_2q245nv9x6.b[43][1]++,query.querySelector(el,'option')));cov_2q245nv9x6.s[91]++;if(selected){cov_2q245nv9x6.b[44][0]++;cov_2q245nv9x6.s[92]++;ret=getName(selected,recursive,referenced);}else{cov_2q245nv9x6.b[44][1]++;}}else{cov_2q245nv9x6.b[42][1]++;cov_2q245nv9x6.s[93]++;if(query.matches(el,'range')){cov_2q245nv9x6.b[45][0]++;cov_2q245nv9x6.s[94]++;ret=''+((cov_2q245nv9x6.b[46][0]++,query.getAttribute(el,'valuetext'))||(cov_2q245nv9x6.b[46][1]++,query.getAttribute(el,'valuenow'))||(cov_2q245nv9x6.b[46][2]++,el.value));}else{cov_2q245nv9x6.b[45][1]++;}}}}else{cov_2q245nv9x6.b[38][1]++;}}else{cov_2q245nv9x6.b[36][1]++;}cov_2q245nv9x6.s[95]++;if((cov_2q245nv9x6.b[48][0]++,!ret.trim())&&((cov_2q245nv9x6.b[48][1]++,recursive)||(cov_2q245nv9x6.b[48][2]++,allowNameFromContent(el)))&&(cov_2q245nv9x6.b[48][3]++,!query.matches(el,'menu'))){cov_2q245nv9x6.b[47][0]++;cov_2q245nv9x6.s[96]++;ret=getContent(el,referenced);}else{cov_2q245nv9x6.b[47][1]++;}cov_2q245nv9x6.s[97]++;if(!ret.trim()){cov_2q245nv9x6.b[49][0]++;cov_2q245nv9x6.s[98]++;for(var selector in constants.nameDefaults){cov_2q245nv9x6.s[99]++;if(el.matches(selector)){cov_2q245nv9x6.b[50][0]++;cov_2q245nv9x6.s[100]++;ret=constants.nameDefaults[selector];}else{cov_2q245nv9x6.b[50][1]++;}}}else{cov_2q245nv9x6.b[49][1]++;}cov_2q245nv9x6.s[101]++;if(!ret.trim()){cov_2q245nv9x6.b[51][0]++;cov_2q245nv9x6.s[102]++;ret=(cov_2q245nv9x6.b[52][0]++,el.title)||(cov_2q245nv9x6.b[52][1]++,'');}else{cov_2q245nv9x6.b[51][1]++;}var before=(cov_2q245nv9x6.s[103]++,getPseudoContent(el,':before'));var after=(cov_2q245nv9x6.s[104]++,getPseudoContent(el,':after'));cov_2q245nv9x6.s[105]++;return before+ret+after;};cov_2q245nv9x6.s[106]++;var getNameTrimmed=function(el){cov_2q245nv9x6.f[9]++;cov_2q245nv9x6.s[107]++;return getName(el).replace(/\s+/g,' ').trim();};cov_2q245nv9x6.s[108]++;var getDescription=function(el){cov_2q245nv9x6.f[10]++;var ret=(cov_2q245nv9x6.s[109]++,'');cov_2q245nv9x6.s[110]++;if(el.matches('[aria-describedby]')){cov_2q245nv9x6.b[53][0]++;var ids=(cov_2q245nv9x6.s[111]++,el.getAttribute('aria-describedby').split(/\s+/));var strings=(cov_2q245nv9x6.s[112]++,ids.map(function(id){cov_2q245nv9x6.f[11]++;var label=(cov_2q245nv9x6.s[113]++,document.getElementById(id));cov_2q245nv9x6.s[114]++;return label?(cov_2q245nv9x6.b[54][0]++,getName(label,true,label)):(cov_2q245nv9x6.b[54][1]++,'');}));cov_2q245nv9x6.s[115]++;ret=strings.join(' ');}else{cov_2q245nv9x6.b[53][1]++;cov_2q245nv9x6.s[116]++;if(el.title){cov_2q245nv9x6.b[55][0]++;cov_2q245nv9x6.s[117]++;ret=el.title;}else{cov_2q245nv9x6.b[55][1]++;cov_2q245nv9x6.s[118]++;if(el.placeholder){cov_2q245nv9x6.b[56][0]++;cov_2q245nv9x6.s[119]++;ret=el.placeholder;}else{cov_2q245nv9x6.b[56][1]++;}}}cov_2q245nv9x6.s[120]++;ret=((cov_2q245nv9x6.b[57][0]++,ret)||(cov_2q245nv9x6.b[57][1]++,'')).trim().replace(/\s+/g,' ');cov_2q245nv9x6.s[121]++;if(ret===getNameTrimmed(el)){cov_2q245nv9x6.b[58][0]++;cov_2q245nv9x6.s[122]++;ret='';}else{cov_2q245nv9x6.b[58][1]++;}cov_2q245nv9x6.s[123]++;return ret;};cov_2q245nv9x6.s[124]++;module.exports={getName:getNameTrimmed,getDescription:getDescription};
-1 633
-1 634 },{"./constants.js":5,"./query.js":7,"./util.js":8}],7:[function(require,module,exports){
-1 635 var constants = require('./constants.js');
-1 636 var util = require('./util.js');
-1 637
-1 638 var getSubRoles = function(roles) {
-1 639 return [].concat.apply([], roles.map(function(role) {
-1 640 return constants.subRoles[role] || [role];
-1 641 }));
-1 642 };
-1 643
-1 644 // candidates can be passed for performance optimization
-1 645 var _getRole = function(el, candidates) {
-1 646 if (el.hasAttribute('role')) {
-1 647 return el.getAttribute('role');
-1 648 }
-1 649 for (var role in constants.extraSelectors) {
-1 650 var selector = constants.extraSelectors[role].join(',');
-1 651 if ((!candidates || candidates.indexOf(role) !== -1) && el.matches(selector)) {
-1 652 return role;
-1 653 }
-1 654 }
-1 655
-1 656 if (!candidates ||
-1 657 candidates.indexOf('banner') !== -1 ||
-1 658 candidates.indexOf('contentinfo') !== -1) {
-1 659 var scoped = el.matches(constants.scoped);
-1 660
-1 661 if (el.matches('header') && !scoped) {
-1 662 return 'banner';
-1 663 }
-1 664 if (el.matches('footer') && !scoped) {
-1 665 return 'contentinfo';
-1 666 }
-1 667 }
-1 668 };
-1 669
-1 670 var getAttribute = function(el, key, _hiddenRoot) {
-1 671 if (key === 'hidden' && el === _hiddenRoot) { // used for name calculation
-1 672 return false;
-1 673 }
-1 674
-1 675 if (constants.attributeStrongMapping.hasOwnProperty(key)) {
-1 676 var value = el[constants.attributeStrongMapping[key]];
-1 677 if (value) {
-1 678 return value;
-1 679 }
-1 680 }
-1 681 if (key === 'readonly' && el.contentEditable) {
-1 682 return false;
-1 683 } else if (key === 'invalid' && el.checkValidity) {
-1 684 return !el.checkValidity();
-1 685 } else if (key === 'hidden') {
-1 686 var style = window.getComputedStyle(el);
-1 687 if (style.display === 'none' || style.visibility === 'hidden') {
-1 688 return true;
-1 689 }
-1 690 }
-1 691
-1 692 var type = constants.attributes[key];
-1 693 var raw = el.getAttribute('aria-' + key);
-1 694
-1 695 if (raw) {
-1 696 if (type === 'bool') {
-1 697 return raw === 'true';
-1 698 } else if (type === 'tristate') {
-1 699 return raw === 'true' ? true : raw === 'false' ? false : 'mixed';
-1 700 } else if (type === 'bool-undefined') {
-1 701 return raw === 'true' ? true : raw === 'false' ? false : undefined;
-1 702 } else if (type === 'id-list') {
-1 703 return raw.split(/\s+/);
-1 704 } else if (type === 'integer') {
-1 705 return parseInt(raw);
-1 706 } else if (type === 'number') {
-1 707 return parseFloat(raw);
-1 708 } else if (type === 'token-list') {
-1 709 return raw.split(/\s+/);
-1 710 } else {
-1 711 return raw;
-1 712 }
-1 713 }
-1 714
-1 715 // TODO
-1 716 // autocomplete
-1 717 // contextmenu -> aria-haspopup
-1 718 // indeterminate -> aria-checked="mixed"
-1 719 // list -> aria-controls
-1 720
-1 721 if (key === 'level') {
-1 722 for (var i = 1; i <= 6; i++) {
-1 723 if (el.tagName.toLowerCase() === 'h' + i) {
-1 724 return i;
-1 725 }
-1 726 }
-1 727 } else if (key === 'hidden') {
-1 728 if (el.clientHeight === 0) { // rough check for performance
-1 729 return el.parentNode && getAttribute(el.parentNode, 'hidden', _hiddenRoot);
-1 730 }
-1 731 } else if (constants.attributeWeakMapping.hasOwnProperty(key)) {
-1 732 return el[constants.attributeWeakMapping[key]];
-1 733 }
-1 734
-1 735 if (type === 'bool' || type === 'tristate') {
-1 736 return false;
-1 737 }
-1 738 };
-1 739
-1 740 var matches = function(el, selector) {
-1 741 var actual;
-1 742
-1 743 if (selector.substr(0, 1) === ':') {
-1 744 var attr = selector.substr(1);
-1 745 return getAttribute(el, attr);
-1 746 } else if (selector.substr(0, 1) === '[') {
-1 747 var match = /\[([a-z]+)="(.*)"\]/.exec(selector);
-1 748 actual = getAttribute(el, match[1]);
-1 749 var rawValue = match[2];
-1 750 return actual.toString() == rawValue;
-1 751 } else {
-1 752 var candidates = getSubRoles(selector.split(','));
-1 753 actual = _getRole(el, candidates);
-1 754 return candidates.indexOf(actual) !== -1;
-1 755 }
-1 756 };
-1 757
-1 758 var _querySelector = function(all) {
-1 759 return function(root, role) {
-1 760 var results = [];
-1 761 util.walkDOM(root, function(node) {
-1 762 if (node.nodeType === node.ELEMENT_NODE) {
-1 763 // FIXME: skip hidden elements
-1 764 if (matches(node, role)) {
-1 765 results.push(node);
-1 766 if (!all) {
-1 767 return false;
-1 768 }
-1 769 }
-1 770 }
-1 771 });
-1 772 return all ? results : results[0];
-1 773 };
-1 774 };
-1 775
-1 776 var closest = function(el, selector) {
-1 777 return util.searchUp(el, function(candidate) {
-1 778 return matches(candidate, selector);
-1 779 });
-1 780 };
-1 781
-1 782 module.exports = {
-1 783 getRole: function(el) {
-1 784 return _getRole(el);
-1 785 },
-1 786 getAttribute: getAttribute,
-1 787 matches: matches,
-1 788 querySelector: _querySelector(),
-1 789 querySelectorAll: _querySelector(true),
-1 790 closest: closest,
-1 791 };
-1 792
-1 793 },{"./constants.js":5,"./util.js":8}],8:[function(require,module,exports){
-1 794 var walkDOM = function(root, fn) {
-1 795 if (fn(root) === false) {
-1 796 return false;
-1 797 }
-1 798 var node = root.firstChild;
-1 799 while (node) {
-1 800 if (walkDOM(node, fn) === false) {
-1 801 return false;
-1 802 }
-1 803 node = node.nextSibling;
-1 804 }
-1 805 };
-1 806
-1 807 var searchUp = function(el, test) {
-1 808 var candidate = el.parentElement;
-1 809 if (candidate) {
-1 810 if (test(candidate)) {
-1 811 return candidate;
-1 812 } else {
-1 813 return searchUp(candidate, test);
-1 814 }
-1 815 }
-1 816 };
-1 817
-1 818 module.exports = {
-1 819 walkDOM: walkDOM,
-1 820 searchUp: searchUp,
-1 821 };
-1 822
-1 823 },{}],9:[function(require,module,exports){
-1 824 var currentVersion = "2.20";
-1 825
-1 826 /*!
-1 827 CalcNames: The AccName Computation Prototype, compute the Name and Description property values for a DOM node
-1 828 Returns an object with 'name' and 'desc' properties.
-1 829 Functionality mirrors the steps within the W3C Accessible Name and Description computation algorithm.
-1 830 http://www.w3.org/TR/accname-aam-1.1/
-1 831 Authored by Bryan Garaventa, plus refactoring contrabutions by Tobias Bengfort
-1 832 https://github.com/whatsock/w3c-alternative-text-computation
-1 833 Distributed under the terms of the Open Source Initiative OSI - MIT License
-1 834 */
-1 835
-1 836 // AccName Computation Prototype
-1 837 var calcNames = function(node, fnc, preventVisualARIASelfCSSRef) {
-1 838 var props = { name: "", desc: "" };
-1 839 if (!node || node.nodeType !== 1) {
-1 840 return props;
-1 841 }
-1 842 var rootNode = node;
-1 843
-1 844 // Track nodes to prevent duplicate node reference parsing.
-1 845 var nodes = [];
-1 846 // Track aria-owns references to prevent duplicate parsing.
-1 847 var owns = [];
-1 848
-1 849 // Recursively process a DOM node to compute an accessible name in accordance with the spec
-1 850 var walk = function(
-1 851 refNode,
-1 852 stop,
-1 853 skip,
-1 854 nodesToIgnoreValues,
-1 855 skipAbort,
-1 856 ownedBy
-1 857 ) {
-1 858 var fullResult = {
-1 859 name: "",
-1 860 title: ""
-1 861 };
-1 862
-1 863 /*
-1 864 ARIA Role Exception Rule Set 1.1
-1 865 The following Role Exception Rule Set is based on the following ARIA Working Group discussion involving all relevant browser venders.
-1 866 https://lists.w3.org/Archives/Public/public-aria/2017Jun/0057.html
-1 867 */
-1 868 var isException = function(node, refNode) {
-1 869 if (!refNode || !node || refNode.nodeType !== 1 || node.nodeType !== 1) {
-1 870 return false;
-1 871 }
-1 872
-1 873 var inList = function(node, list) {
-1 874 var role = getRole(node);
-1 875 var tag = node.nodeName.toLowerCase();
-1 876 return (
-1 877 (role && list.roles.indexOf(role) >= 0) ||
-1 878 (!role && list.tags.indexOf(tag) >= 0)
-1 879 );
-1 880 };
-1 881
-1 882 // The list3 overrides must be checked first.
-1 883 if (inList(node, list3)) {
-1 884 if (
-1 885 node === refNode &&
-1 886 !(node.id && ownedBy[node.id] && ownedBy[node.id].node)
-1 887 ) {
-1 888 return !isFocusable(node);
-1 889 } else {
-1 890 // 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.
-1 891 return !(
-1 892 (inParent(node, ownedBy.top) &&
-1 893 node.nodeName.toLowerCase() !== "select") ||
-1 894 inList(refNode, list1)
-1 895 );
-1 896 }
-1 897 }
-1 898 // Otherwise process list2 to identify roles to ignore processing name from content.
-1 899 else if (
-1 900 inList(node, list2) ||
-1 901 (node === rootNode && !inList(node, list1))
-1 902 ) {
-1 903 return true;
-1 904 } else {
-1 905 return false;
-1 906 }
-1 907 };
-1 908
-1 909 var inParent = function(node, parent) {
-1 910 var trackNodes = [];
-1 911 while (node) {
-1 912 if (
-1 913 node.id &&
-1 914 ownedBy[node.id] &&
-1 915 ownedBy[node.id].node &&
-1 916 trackNodes.indexOf(node) === -1
-1 917 ) {
-1 918 trackNodes.push(node);
-1 919 node = ownedBy[node.id].node;
-1 920 } else {
-1 921 node = node.parentNode;
-1 922 }
-1 923 if (node && node === parent) {
-1 924 return true;
-1 925 } else if (!node || node === ownedBy.top || node === document.body) {
-1 926 return false;
-1 927 }
-1 928 }
-1 929 return false;
-1 930 };
-1 931
-1 932 // Placeholder for storing CSS before and after pseudo element text values for the top level node
-1 933 var cssOP = {
-1 934 before: "",
-1 935 after: ""
-1 936 };
-1 937
-1 938 if (ownedBy.ref) {
-1 939 if (isParentHidden(refNode, document.body, true, true)) {
-1 940 // If referenced via aria-labelledby or aria-describedby, do not return a name or description if a parent node is hidden.
-1 941 return fullResult;
-1 942 } else if (isHidden(refNode, document.body)) {
-1 943 // Otherwise, if aria-labelledby or aria-describedby reference a node that is explicitly hidden, then process all children regardless of their individual hidden states.
-1 944 var ignoreHidden = true;
-1 945 }
-1 946 }
-1 947
-1 948 if (nodes.indexOf(refNode) === -1) {
-1 949 // Store the before and after pseudo element 'content' values for the top level DOM node
-1 950 // Note: If the pseudo element includes block level styling, a space will be added, otherwise inline is asumed and no spacing is added.
-1 951 cssOP = getCSSText(refNode, null);
-1 952
-1 953 // Enabled in Visual ARIA to prevent self referencing by Visual ARIA tooltips
-1 954 if (preventVisualARIASelfCSSRef) {
-1 955 if (
-1 956 cssOP.before.indexOf(" [ARIA] ") !== -1 ||
-1 957 cssOP.before.indexOf(" aria-") !== -1 ||
-1 958 cssOP.before.indexOf(" accName: ") !== -1
-1 959 )
-1 960 cssOP.before = "";
-1 961 if (
-1 962 cssOP.after.indexOf(" [ARIA] ") !== -1 ||
-1 963 cssOP.after.indexOf(" aria-") !== -1 ||
-1 964 cssOP.after.indexOf(" accDescription: ") !== -1
-1 965 )
-1 966 cssOP.after = "";
-1 967 }
-1 968 }
-1 969
-1 970 // Recursively apply the same naming computation to all nodes within the referenced structure
-1 971 var walkDOM = function(node, fn, refNode) {
-1 972 var res = {
-1 973 name: "",
-1 974 title: ""
-1 975 };
-1 976 if (!node) {
-1 977 return res;
-1 978 }
-1 979 var nodeIsBlock =
-1 980 node && node.nodeType === 1 && isBlockLevelElement(node) ? true : false;
-1 981 var fResult = fn(node) || {};
-1 982 if (fResult.name && fResult.name.length) {
-1 983 res.name += fResult.name;
-1 984 }
-1 985 if (!isException(node, ownedBy.top, ownedBy)) {
-1 986 node = node.firstChild;
-1 987 while (node) {
-1 988 res.name += walkDOM(node, fn, refNode).name;
-1 989 node = node.nextSibling;
-1 990 }
-1 991 }
-1 992 res.name += fResult.owns || "";
-1 993 if (rootNode === refNode && !trim(res.name) && trim(fResult.title)) {
-1 994 res.name = addSpacing(fResult.title);
-1 995 } else if (rootNode === refNode && trim(fResult.title)) {
-1 996 res.title = addSpacing(fResult.title);
-1 997 }
-1 998 if (rootNode === refNode && trim(fResult.desc)) {
-1 999 res.title = addSpacing(fResult.desc);
-1 1000 }
-1 1001 if (nodeIsBlock || fResult.isWidget) {
-1 1002 res.name = addSpacing(res.name);
-1 1003 }
-1 1004 return res;
-1 1005 };
-1 1006
-1 1007 fullResult = walkDOM(
-1 1008 refNode,
-1 1009 function(node) {
-1 1010 var i = 0;
-1 1011 var element = null;
-1 1012 var ids = [];
-1 1013 var parts = [];
-1 1014 var result = {
-1 1015 name: "",
-1 1016 title: "",
-1 1017 owns: ""
-1 1018 };
-1 1019 var isEmbeddedNode =
-1 1020 node &&
-1 1021 node.nodeType === 1 &&
-1 1022 nodesToIgnoreValues &&
-1 1023 nodesToIgnoreValues.length &&
-1 1024 nodesToIgnoreValues.indexOf(node) !== -1 &&
-1 1025 node === rootNode &&
-1 1026 node !== refNode
-1 1027 ? true
-1 1028 : false;
-1 1029
-1 1030 if (
-1 1031 (skip ||
-1 1032 !node ||
-1 1033 nodes.indexOf(node) !== -1 ||
-1 1034 (!ignoreHidden && isHidden(node, ownedBy.top))) &&
-1 1035 !skipAbort &&
-1 1036 !isEmbeddedNode
-1 1037 ) {
-1 1038 // Abort if algorithm step is already completed, or if node is a hidden child of refNode, or if this node has already been processed, or skip abort if aria-labelledby self references same node.
-1 1039 return result;
-1 1040 }
-1 1041
-1 1042 if (nodes.indexOf(node) === -1) {
-1 1043 nodes.push(node);
-1 1044 }
-1 1045
-1 1046 // Store name for the current node.
-1 1047 var name = "";
-1 1048 // Store name from aria-owns references if detected.
-1 1049 var ariaO = "";
-1 1050 // Placeholder for storing CSS before and after pseudo element text values for the current node container element
-1 1051 var cssO = {
-1 1052 before: "",
-1 1053 after: ""
-1 1054 };
-1 1055
-1 1056 var parent = refNode === node ? node : node.parentNode;
-1 1057 if (nodes.indexOf(parent) === -1) {
-1 1058 nodes.push(parent);
-1 1059 // Store the before and after pseudo element 'content' values for the current node container element
-1 1060 // Note: If the pseudo element includes block level styling, a space will be added, otherwise inline is asumed and no spacing is added.
-1 1061 cssO = getCSSText(parent, refNode);
-1 1062
-1 1063 // Enabled in Visual ARIA to prevent self referencing by Visual ARIA tooltips
-1 1064 if (preventVisualARIASelfCSSRef) {
-1 1065 if (
-1 1066 cssO.before.indexOf(" [ARIA] ") !== -1 ||
-1 1067 cssO.before.indexOf(" aria-") !== -1 ||
-1 1068 cssO.before.indexOf(" accName: ") !== -1
-1 1069 )
-1 1070 cssO.before = "";
-1 1071 if (
-1 1072 cssO.after.indexOf(" [ARIA] ") !== -1 ||
-1 1073 cssO.after.indexOf(" aria-") !== -1 ||
-1 1074 cssO.after.indexOf(" accDescription: ") !== -1
-1 1075 )
-1 1076 cssO.after = "";
-1 1077 }
-1 1078 }
-1 1079
-1 1080 // Process standard DOM element node
-1 1081 if (node.nodeType === 1) {
-1 1082 var aLabelledby = node.getAttribute("aria-labelledby") || "";
-1 1083 var aDescribedby = node.getAttribute("aria-describedby") || "";
-1 1084 var aLabel = node.getAttribute("aria-label") || "";
-1 1085 var nTitle = node.getAttribute("title") || "";
-1 1086 var nTag = node.nodeName.toLowerCase();
-1 1087 var nRole = getRole(node);
-1 1088
-1 1089 var isNativeFormField = nativeFormFields.indexOf(nTag) !== -1;
-1 1090 var isNativeButton = ["input"].indexOf(nTag) !== -1;
-1 1091 var isRangeWidgetRole = rangeWidgetRoles.indexOf(nRole) !== -1;
-1 1092 var isEditWidgetRole = editWidgetRoles.indexOf(nRole) !== -1;
-1 1093 var isSelectWidgetRole = selectWidgetRoles.indexOf(nRole) !== -1;
-1 1094 var isSimulatedFormField =
-1 1095 isRangeWidgetRole ||
-1 1096 isEditWidgetRole ||
-1 1097 isSelectWidgetRole ||
-1 1098 nRole === "combobox";
-1 1099 var isWidgetRole =
-1 1100 (isSimulatedFormField || otherWidgetRoles.indexOf(nRole) !== -1) &&
-1 1101 nRole !== "link";
-1 1102 result.isWidget = isNativeFormField || isWidgetRole;
-1 1103
-1 1104 var hasName = false;
-1 1105 var aOwns = node.getAttribute("aria-owns") || "";
-1 1106 var isSeparatChildFormField =
-1 1107 !isEmbeddedNode &&
-1 1108 ((node !== refNode &&
-1 1109 (isNativeFormField || isSimulatedFormField)) ||
-1 1110 (node.id &&
-1 1111 ownedBy[node.id] &&
-1 1112 ownedBy[node.id].target &&
-1 1113 ownedBy[node.id].target === node))
-1 1114 ? true
-1 1115 : false;
-1 1116
-1 1117 if (!stop && node === refNode) {
-1 1118 // Check for non-empty value of aria-labelledby if current node equals reference node, follow each ID ref, then stop and process no deeper.
-1 1119 if (aLabelledby) {
-1 1120 ids = aLabelledby.split(/\s+/);
-1 1121 parts = [];
-1 1122 for (i = 0; i < ids.length; i++) {
-1 1123 element = document.getElementById(ids[i]);
-1 1124 // Also prevent the current form field from having its value included in the naming computation if nested as a child of label
-1 1125 parts.push(
-1 1126 walk(element, true, skip, [node], element === refNode, {
-1 1127 ref: ownedBy,
-1 1128 top: element
-1 1129 }).name
-1 1130 );
-1 1131 }
-1 1132 // Check for blank value, since whitespace chars alone are not valid as a name
-1 1133 name = trim(parts.join(" "));
-1 1134
-1 1135 if (trim(name)) {
-1 1136 hasName = true;
-1 1137 // Abort further recursion if name is valid.
-1 1138 skip = true;
-1 1139 }
-1 1140 }
-1 1141
-1 1142 // Check for non-empty value of aria-describedby if current node equals reference node, follow each ID ref, then stop and process no deeper.
-1 1143 if (aDescribedby) {
-1 1144 var desc = "";
-1 1145 ids = aDescribedby.split(/\s+/);
-1 1146 parts = [];
-1 1147 for (i = 0; i < ids.length; i++) {
-1 1148 element = document.getElementById(ids[i]);
-1 1149 // Also prevent the current form field from having its value included in the naming computation if nested as a child of label
-1 1150 parts.push(
-1 1151 walk(element, true, false, [node], false, {
-1 1152 ref: ownedBy,
-1 1153 top: element
-1 1154 }).name
-1 1155 );
-1 1156 }
-1 1157 // Check for blank value, since whitespace chars alone are not valid as a name
-1 1158 desc = trim(parts.join(" "));
-1 1159
-1 1160 if (trim(desc)) {
-1 1161 result.desc = desc;
-1 1162 }
-1 1163 }
-1 1164 }
-1 1165
-1 1166 // 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.
-1 1167 if (isSeparatChildFormField) {
-1 1168 // Prevent the referencing node from having its value included in the case of form control labels that contain the element with focus.
-1 1169 if (
-1 1170 !(
-1 1171 nodesToIgnoreValues &&
-1 1172 nodesToIgnoreValues.length &&
-1 1173 nodesToIgnoreValues.indexOf(node) !== -1
-1 1174 )
-1 1175 ) {
-1 1176 if (isRangeWidgetRole) {
-1 1177 // For range widgets, append aria-valuetext if non-empty, or aria-valuenow if non-empty, or node.value if applicable.
-1 1178 name = getObjectValue(nRole, node, true);
-1 1179 } else if (
-1 1180 isEditWidgetRole ||
-1 1181 (nRole === "combobox" && isNativeFormField)
-1 1182 ) {
-1 1183 // For simulated edit widgets, append text from content if applicable, or node.value if applicable.
-1 1184 name = getObjectValue(nRole, node, false, true);
-1 1185 } else if (isSelectWidgetRole) {
-1 1186 // For simulated select widgets, append same naming computation algorithm for all child nodes including aria-selected="true" separated by a space when multiple.
-1 1187 // Also filter nodes so that only valid child roles of relevant parent role that include aria-selected="true" are included.
-1 1188 name = getObjectValue(nRole, node, false, false, true);
-1 1189 } else if (
-1 1190 isNativeFormField &&
-1 1191 ["input", "textarea"].indexOf(nTag) !== -1 &&
-1 1192 (!isWidgetRole || isEditWidgetRole)
-1 1193 ) {
-1 1194 // For native edit fields, append node.value when applicable.
-1 1195 name = getObjectValue(nRole, node, false, false, false, true);
-1 1196 } else if (
-1 1197 isNativeFormField &&
-1 1198 nTag === "select" &&
-1 1199 (!isWidgetRole || nRole === "combobox")
-1 1200 ) {
-1 1201 // 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".
-1 1202 // Reference: https://github.com/WhatSock/w3c-alternative-text-computation/issues/7
-1 1203 name = getObjectValue(nRole, node, false, false, true, true);
-1 1204 }
-1 1205
-1 1206 // Check for blank value, since whitespace chars alone are not valid as a name
-1 1207 name = trim(name);
-1 1208 }
-1 1209
-1 1210 if (trim(name)) {
-1 1211 hasName = true;
-1 1212 }
-1 1213 }
-1 1214
-1 1215 // Otherwise, if current node has a non-empty aria-label then set as name and process no deeper within the branch.
-1 1216 if (!hasName && trim(aLabel) && !isSeparatChildFormField) {
-1 1217 name = aLabel;
-1 1218
-1 1219 // Check for blank value, since whitespace chars alone are not valid as a name
-1 1220 if (trim(name)) {
-1 1221 hasName = true;
-1 1222 if (node === refNode) {
-1 1223 // If name is non-empty and both the current and refObject nodes match, then don't process any deeper within the branch.
-1 1224 skip = true;
-1 1225 }
-1 1226 }
-1 1227 }
-1 1228
-1 1229 // 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.
-1 1230 if (!hasName && node === refNode && isNativeFormField) {
-1 1231 // Logic modified to match issue
-1 1232 // https://github.com/WhatSock/w3c-alternative-text-computation/issues/12 */
-1 1233 var labels = document.querySelectorAll("label");
-1 1234 var implicitLabel = getParent(node, "label") || false;
-1 1235 var explicitLabel =
-1 1236 node.id &&
-1 1237 document.querySelectorAll('label[for="' + node.id + '"]').length
-1 1238 ? document.querySelector('label[for="' + node.id + '"]')
-1 1239 : false;
-1 1240 var implicitI = 0;
-1 1241 var explicitI = 0;
-1 1242 for (i = 0; i < labels.length; i++) {
-1 1243 if (labels[i] === implicitLabel) {
-1 1244 implicitI = i;
-1 1245 } else if (labels[i] === explicitLabel) {
-1 1246 explicitI = i;
-1 1247 }
-1 1248 }
-1 1249 var isImplicitFirst =
-1 1250 implicitLabel &&
-1 1251 implicitLabel.nodeType === 1 &&
-1 1252 explicitLabel &&
-1 1253 explicitLabel.nodeType === 1 &&
-1 1254 implicitI < explicitI
-1 1255 ? true
-1 1256 : false;
-1 1257
-1 1258 if (explicitLabel) {
-1 1259 var eLblName = trim(
-1 1260 walk(explicitLabel, true, skip, [node], false, {
-1 1261 ref: ownedBy,
-1 1262 top: explicitLabel
-1 1263 }).name
-1 1264 );
-1 1265 }
-1 1266 if (implicitLabel && implicitLabel !== explicitLabel) {
-1 1267 var iLblName = trim(
-1 1268 walk(implicitLabel, true, skip, [node], false, {
-1 1269 ref: ownedBy,
-1 1270 top: implicitLabel
-1 1271 }).name
-1 1272 );
-1 1273 }
-1 1274
-1 1275 if (iLblName && eLblName && isImplicitFirst) {
-1 1276 name = iLblName + " " + eLblName;
-1 1277 } else if (eLblName && iLblName) {
-1 1278 name = eLblName + " " + iLblName;
-1 1279 } else if (eLblName) {
-1 1280 name = eLblName;
-1 1281 } else if (iLblName) {
-1 1282 name = iLblName;
-1 1283 }
-1 1284
-1 1285 if (trim(name)) {
-1 1286 hasName = true;
-1 1287 }
-1 1288 }
-1 1289
-1 1290 // Process native form field buttons in accordance with the HTML AAM
-1 1291 // https://w3c.github.io/html-aam/#accessible-name-and-description-computation
-1 1292 var btnType = (isNativeButton && node.getAttribute("type")) || false;
-1 1293 var btnValue = (btnType && trim(node.getAttribute("value"))) || false;
-1 1294
-1 1295 var rolePresentation =
-1 1296 !hasName &&
-1 1297 nRole &&
-1 1298 presentationRoles.indexOf(nRole) !== -1 &&
-1 1299 !isFocusable(node) &&
-1 1300 !hasGlobalAttr(node)
-1 1301 ? true
-1 1302 : false;
-1 1303 var nAlt = rolePresentation ? "" : trim(node.getAttribute("alt"));
-1 1304
-1 1305 // Otherwise, if name is still empty and current node is a standard non-presentational img or image button with a non-empty alt attribute, set alt attribute value as the accessible name.
-1 1306 if (
-1 1307 !hasName &&
-1 1308 !rolePresentation &&
-1 1309 (nTag === "img" || btnType === "image") &&
-1 1310 nAlt
-1 1311 ) {
-1 1312 // Check for blank value, since whitespace chars alone are not valid as a name
-1 1313 name = trim(nAlt);
-1 1314 if (trim(name)) {
-1 1315 hasName = true;
-1 1316 }
-1 1317 }
-1 1318
-1 1319 if (
-1 1320 !hasName &&
-1 1321 node === refNode &&
-1 1322 btnType &&
-1 1323 ["button", "image", "submit", "reset"].indexOf(btnType) !== -1
-1 1324 ) {
-1 1325 if (btnValue) {
-1 1326 name = btnValue;
-1 1327 } else {
-1 1328 switch (btnType) {
-1 1329 case "submit":
-1 1330 case "image":
-1 1331 name = "Submit Query";
-1 1332 break;
-1 1333 case "reset":
-1 1334 name = "Reset";
-1 1335 break;
-1 1336 default:
-1 1337 name = "";
-1 1338 }
-1 1339 }
-1 1340 if (trim(name)) {
-1 1341 hasName = true;
-1 1342 }
-1 1343 }
-1 1344
-1 1345 if (
-1 1346 hasName &&
-1 1347 node === refNode &&
-1 1348 btnType &&
-1 1349 ["button", "submit", "reset"].indexOf(btnType) !== -1 &&
-1 1350 btnValue &&
-1 1351 btnValue !== name &&
-1 1352 !result.desc
-1 1353 ) {
-1 1354 result.desc = btnValue;
-1 1355 }
-1 1356
-1 1357 // Otherwise, if current node is the same as rootNode and is non-presentational and includes a non-empty title attribute and is not a separate embedded form field, store title attribute value as the accessible name if name is still empty, or the description if not.
-1 1358 if (
-1 1359 node === rootNode &&
-1 1360 !rolePresentation &&
-1 1361 trim(nTitle) &&
-1 1362 !isSeparatChildFormField
-1 1363 ) {
-1 1364 result.title = trim(nTitle);
-1 1365 }
-1 1366
-1 1367 // Check for non-empty value of aria-owns, follow each ID ref, then process with same naming computation.
-1 1368 // Also abort aria-owns processing if contained on an element that does not support child elements.
-1 1369 if (aOwns && !isNativeFormField && nTag !== "img") {
-1 1370 ids = aOwns.split(/\s+/);
-1 1371 parts = [];
-1 1372 for (i = 0; i < ids.length; i++) {
-1 1373 element = document.getElementById(ids[i]);
-1 1374 // Abort processing if the referenced node has already been traversed
-1 1375 if (element && owns.indexOf(ids[i]) === -1) {
-1 1376 owns.push(ids[i]);
-1 1377 var oBy = { ref: ownedBy, top: ownedBy.top };
-1 1378 oBy[ids[i]] = {
-1 1379 refNode: refNode,
-1 1380 node: node,
-1 1381 target: element
-1 1382 };
-1 1383 if (!isParentHidden(element, document.body, true)) {
-1 1384 parts.push(walk(element, true, skip, [], false, oBy).name);
-1 1385 }
-1 1386 }
-1 1387 }
-1 1388 // Join without adding whitespace since this is already handled by parsing individual nodes within the algorithm steps.
-1 1389 ariaO = parts.join("");
-1 1390 }
-1 1391 }
-1 1392
-1 1393 // Otherwise, process text node
-1 1394 else if (node.nodeType === 3) {
-1 1395 name = node.data;
-1 1396 }
-1 1397
-1 1398 // Prepend and append the current CSS pseudo element text, plus normalize all whitespace such as newline characters and others into flat spaces.
-1 1399 name = cssO.before + name.replace(/\s+/g, " ") + cssO.after;
-1 1400
-1 1401 if (
-1 1402 name.length &&
-1 1403 !hasParentLabelOrHidden(node, ownedBy.top, ownedBy, ignoreHidden)
-1 1404 ) {
-1 1405 result.name = name;
-1 1406 }
-1 1407
-1 1408 result.owns = ariaO;
-1 1409
-1 1410 return result;
-1 1411 },
-1 1412 refNode
-1 1413 );
-1 1414
-1 1415 // Prepend and append the refObj CSS pseudo element text, plus normalize whitespace chars into flat spaces.
-1 1416 fullResult.name =
-1 1417 cssOP.before + fullResult.name.replace(/\s+/g, " ") + cssOP.after;
-1 1418
-1 1419 return fullResult;
-1 1420 };
-1 1421
-1 1422 var getRole = function(node) {
-1 1423 var role = node && node.getAttribute ? node.getAttribute("role") : "";
-1 1424 if (!trim(role)) {
-1 1425 return "";
-1 1426 }
-1 1427 var inList = function(list) {
-1 1428 return trim(role).length > 0 && list.roles.indexOf(role) >= 0;
-1 1429 };
-1 1430 var roles = role.split(/\s+/);
-1 1431 for (var i = 0; i < roles.length; i++) {
-1 1432 role = roles[i];
-1 1433 if (
-1 1434 inList(list1) ||
-1 1435 inList(list2) ||
-1 1436 inList(list3) ||
-1 1437 presentationRoles.indexOf(role) !== -1
-1 1438 ) {
-1 1439 return role;
-1 1440 }
-1 1441 }
-1 1442 return "";
-1 1443 };
-1 1444
-1 1445 var isFocusable = function(node) {
-1 1446 var nodeName = node.nodeName.toLowerCase();
-1 1447 if (node.getAttribute("tabindex")) {
-1 1448 return true;
-1 1449 }
-1 1450 if (nodeName === "a" && node.getAttribute("href")) {
-1 1451 return true;
-1 1452 }
-1 1453 if (
-1 1454 ["button", "input", "select", "textarea"].indexOf(nodeName) !== -1 &&
-1 1455 node.getAttribute("type") !== "hidden"
-1 1456 ) {
-1 1457 return true;
-1 1458 }
-1 1459 return false;
-1 1460 };
-1 1461
-1 1462 // ARIA Role Exception Rule Set 1.1
-1 1463 // The following Role Exception Rule Set is based on the following ARIA Working Group discussion involving all relevant browser venders.
-1 1464 // https://lists.w3.org/Archives/Public/public-aria/2017Jun/0057.html
-1 1465
-1 1466 // Always include name from content when the referenced node matches list1, as well as when child nodes match those within list3
-1 1467 // Note: gridcell was added to list1 to account for focusable gridcells that match the ARIA 1.0 paradigm for interactive grids.
-1 1468 var list1 = {
-1 1469 roles: [
-1 1470 "button",
-1 1471 "checkbox",
-1 1472 "link",
-1 1473 "option",
-1 1474 "radio",
-1 1475 "switch",
-1 1476 "tab",
-1 1477 "treeitem",
-1 1478 "menuitem",
-1 1479 "menuitemcheckbox",
-1 1480 "menuitemradio",
-1 1481 "cell",
-1 1482 "gridcell",
-1 1483 "columnheader",
-1 1484 "rowheader",
-1 1485 "tooltip",
-1 1486 "heading"
-1 1487 ],
-1 1488 tags: [
-1 1489 "a",
-1 1490 "button",
-1 1491 "summary",
-1 1492 "input",
-1 1493 "h1",
-1 1494 "h2",
-1 1495 "h3",
-1 1496 "h4",
-1 1497 "h5",
-1 1498 "h6",
-1 1499 "menuitem",
-1 1500 "option",
-1 1501 "td",
-1 1502 "th"
-1 1503 ]
-1 1504 };
-1 1505 // Never include name from content when current node matches list2
-1 1506 var list2 = {
-1 1507 roles: [
-1 1508 "application",
-1 1509 "alert",
-1 1510 "log",
-1 1511 "marquee",
-1 1512 "timer",
-1 1513 "alertdialog",
-1 1514 "dialog",
-1 1515 "banner",
-1 1516 "complementary",
-1 1517 "form",
-1 1518 "main",
-1 1519 "navigation",
-1 1520 "region",
-1 1521 "search",
-1 1522 "article",
-1 1523 "document",
-1 1524 "feed",
-1 1525 "figure",
-1 1526 "img",
-1 1527 "math",
-1 1528 "toolbar",
-1 1529 "menu",
-1 1530 "menubar",
-1 1531 "grid",
-1 1532 "listbox",
-1 1533 "radiogroup",
-1 1534 "textbox",
-1 1535 "searchbox",
-1 1536 "spinbutton",
-1 1537 "scrollbar",
-1 1538 "slider",
-1 1539 "tablist",
-1 1540 "tabpanel",
-1 1541 "tree",
-1 1542 "treegrid",
-1 1543 "separator"
-1 1544 ],
-1 1545 tags: [
-1 1546 "article",
-1 1547 "aside",
-1 1548 "body",
-1 1549 "select",
-1 1550 "datalist",
-1 1551 "optgroup",
-1 1552 "dialog",
-1 1553 "figure",
-1 1554 "footer",
-1 1555 "form",
-1 1556 "header",
-1 1557 "hr",
-1 1558 "img",
-1 1559 "textarea",
-1 1560 "input",
-1 1561 "main",
-1 1562 "math",
-1 1563 "menu",
-1 1564 "nav",
-1 1565 "section"
-1 1566 ]
-1 1567 };
-1 1568 // 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 matches list1.
-1 1569 var list3 = {
-1 1570 roles: [
-1 1571 "term",
-1 1572 "definition",
-1 1573 "directory",
-1 1574 "list",
-1 1575 "group",
-1 1576 "note",
-1 1577 "status",
-1 1578 "table",
-1 1579 "rowgroup",
-1 1580 "row",
-1 1581 "contentinfo"
-1 1582 ],
-1 1583 tags: [
-1 1584 "dl",
-1 1585 "ul",
-1 1586 "ol",
-1 1587 "dd",
-1 1588 "details",
-1 1589 "output",
-1 1590 "table",
-1 1591 "thead",
-1 1592 "tbody",
-1 1593 "tfoot",
-1 1594 "tr"
-1 1595 ]
-1 1596 };
-1 1597
-1 1598 var nativeFormFields = ["button", "input", "select", "textarea"];
-1 1599 var rangeWidgetRoles = ["scrollbar", "slider", "spinbutton"];
-1 1600 var editWidgetRoles = ["searchbox", "textbox"];
-1 1601 var selectWidgetRoles = ["grid", "listbox", "tablist", "tree", "treegrid"];
-1 1602 var otherWidgetRoles = [
-1 1603 "button",
-1 1604 "checkbox",
-1 1605 "link",
-1 1606 "switch",
-1 1607 "option",
-1 1608 "menu",
-1 1609 "menubar",
-1 1610 "menuitem",
-1 1611 "menuitemcheckbox",
-1 1612 "menuitemradio",
-1 1613 "radio",
-1 1614 "tab",
-1 1615 "treeitem",
-1 1616 "gridcell"
-1 1617 ];
-1 1618 var presentationRoles = ["presentation", "none"];
-1 1619
-1 1620 var hasGlobalAttr = function(node) {
-1 1621 var globalPropsAndStates = [
-1 1622 "busy",
-1 1623 "controls",
-1 1624 "current",
-1 1625 "describedby",
-1 1626 "details",
-1 1627 "disabled",
-1 1628 "dropeffect",
-1 1629 "errormessage",
-1 1630 "flowto",
-1 1631 "grabbed",
-1 1632 "haspopup",
-1 1633 "invalid",
-1 1634 "keyshortcuts",
-1 1635 "live",
-1 1636 "owns",
-1 1637 "roledescription"
-1 1638 ];
-1 1639 for (var i = 0; i < globalPropsAndStates.length; i++) {
-1 1640 var a = trim(node.getAttribute("aria-" + globalPropsAndStates[i]));
-1 1641 if (a) {
-1 1642 return true;
-1 1643 }
-1 1644 }
-1 1645 return false;
-1 1646 };
-1 1647
-1 1648 var isHidden = function(node, refNode) {
-1 1649 var hidden = function(node) {
-1 1650 if (!node || node.nodeType !== 1 || node === refNode) {
-1 1651 return false;
-1 1652 }
-1 1653 if (node.getAttribute("aria-hidden") === "true") {
-1 1654 return true;
-1 1655 }
-1 1656 if (node.getAttribute("hidden")) {
-1 1657 return true;
-1 1658 }
-1 1659 var style = getStyleObject(node);
-1 1660 if (style["display"] === "none" || style["visibility"] === "hidden") {
-1 1661 return true;
-1 1662 }
-1 1663 return false;
-1 1664 };
-1 1665 return hidden(node);
-1 1666 };
-1 1667
-1 1668 var isParentHidden = function(node, refNode, skipOwned, skipCurrent) {
-1 1669 while (node && node !== refNode) {
-1 1670 if (!skipCurrent && node.nodeType === 1 && isHidden(node, refNode)) {
-1 1671 return true;
-1 1672 } else skipCurrent = false;
-1 1673 node = node.parentNode;
-1 1674 }
-1 1675 return false;
-1 1676 };
-1 1677
-1 1678 var getStyleObject = function(node) {
-1 1679 var style = {};
-1 1680 if (document.defaultView && document.defaultView.getComputedStyle) {
-1 1681 style = document.defaultView.getComputedStyle(node, "");
-1 1682 } else if (node.currentStyle) {
-1 1683 style = node.currentStyle;
-1 1684 }
-1 1685 return style;
-1 1686 };
-1 1687
-1 1688 var cleanCSSText = function(node, text) {
-1 1689 var s = text;
-1 1690 if (s.indexOf("attr(") !== -1) {
-1 1691 var m = s.match(/attr\((.|\n|\r\n)*?\)/g);
-1 1692 for (var i = 0; i < m.length; i++) {
-1 1693 var b = m[i].slice(5, -1);
-1 1694 b = node.getAttribute(b) || "";
-1 1695 s = s.replace(m[i], b);
-1 1696 }
-1 1697 }
-1 1698 return s || text;
-1 1699 };
-1 1700
-1 1701 var isBlockLevelElement = function(node, cssObj) {
-1 1702 var styleObject = cssObj || getStyleObject(node);
-1 1703 for (var prop in blockStyles) {
-1 1704 var values = blockStyles[prop];
-1 1705 for (var i = 0; i < values.length; i++) {
-1 1706 if (
-1 1707 styleObject[prop] &&
-1 1708 ((values[i].indexOf("!") === 0 &&
-1 1709 [values[i].slice(1), "inherit", "initial", "unset"].indexOf(
-1 1710 styleObject[prop]
-1 1711 ) === -1) ||
-1 1712 styleObject[prop].indexOf(values[i]) !== -1)
-1 1713 ) {
-1 1714 return true;
-1 1715 }
-1 1716 }
-1 1717 }
-1 1718 if (
-1 1719 !cssObj &&
-1 1720 node.nodeName &&
-1 1721 blockElements.indexOf(node.nodeName.toLowerCase()) !== -1
-1 1722 ) {
-1 1723 return true;
-1 1724 }
-1 1725 return false;
-1 1726 };
-1 1727
-1 1728 // CSS Block Styles indexed from:
-1 1729 // https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context
-1 1730 var blockStyles = {
-1 1731 display: ["block", "grid", "table", "flow-root", "flex"],
-1 1732 position: ["absolute", "fixed"],
-1 1733 float: ["left", "right", "inline"],
-1 1734 clear: ["left", "right", "both", "inline"],
-1 1735 overflow: ["hidden", "scroll", "auto"],
-1 1736 "column-count": ["!auto"],
-1 1737 "column-width": ["!auto"],
-1 1738 "column-span": ["all"],
-1 1739 contain: ["layout", "content", "strict"]
-1 1740 };
-1 1741
-1 1742 // HTML5 Block Elements indexed from:
-1 1743 // https://github.com/webmodules/block-elements
-1 1744 // Note: 'br' was added to this array because it impacts visual display and should thus add a space .
-1 1745 // Reference issue: https://github.com/w3c/accname/issues/4
-1 1746 // Note: Added in 1.13, td, th, tr, and legend
-1 1747 var blockElements = [
-1 1748 "address",
-1 1749 "article",
-1 1750 "aside",
-1 1751 "blockquote",
-1 1752 "br",
-1 1753 "canvas",
-1 1754 "dd",
-1 1755 "div",
-1 1756 "dl",
-1 1757 "dt",
-1 1758 "fieldset",
-1 1759 "figcaption",
-1 1760 "figure",
-1 1761 "footer",
-1 1762 "form",
-1 1763 "h1",
-1 1764 "h2",
-1 1765 "h3",
-1 1766 "h4",
-1 1767 "h5",
-1 1768 "h6",
-1 1769 "header",
-1 1770 "hgroup",
-1 1771 "hr",
-1 1772 "legend",
-1 1773 "li",
-1 1774 "main",
-1 1775 "nav",
-1 1776 "noscript",
-1 1777 "ol",
-1 1778 "output",
-1 1779 "p",
-1 1780 "pre",
-1 1781 "section",
-1 1782 "table",
-1 1783 "td",
-1 1784 "tfoot",
-1 1785 "th",
-1 1786 "tr",
-1 1787 "ul",
-1 1788 "video"
-1 1789 ];
-1 1790
-1 1791 var getObjectValue = function(
-1 1792 role,
-1 1793 node,
-1 1794 isRange,
-1 1795 isEdit,
-1 1796 isSelect,
-1 1797 isNative
-1 1798 ) {
-1 1799 var val = "";
-1 1800 var bypass = false;
-1 1801
-1 1802 if (isRange && !isNative) {
-1 1803 val =
-1 1804 node.getAttribute("aria-valuetext") ||
-1 1805 node.getAttribute("aria-valuenow") ||
-1 1806 "";
-1 1807 } else if (isEdit && !isNative) {
-1 1808 val = getText(node) || "";
-1 1809 } else if (isSelect && !isNative) {
-1 1810 var childRoles = [];
-1 1811 if (role === "grid" || role === "treegrid") {
-1 1812 childRoles = ["gridcell", "rowheader", "columnheader"];
-1 1813 } else if (role === "listbox") {
-1 1814 childRoles = ["option"];
-1 1815 } else if (role === "tablist") {
-1 1816 childRoles = ["tab"];
-1 1817 } else if (role === "tree") {
-1 1818 childRoles = ["treeitem"];
-1 1819 }
-1 1820 val = joinSelectedParts(
-1 1821 node,
-1 1822 node.querySelectorAll('*[aria-selected="true"]'),
-1 1823 false,
-1 1824 childRoles
-1 1825 );
-1 1826 bypass = true;
-1 1827 }
-1 1828 val = trim(val);
-1 1829 if (!val && (isRange || isEdit) && node.value) {
-1 1830 val = node.value;
-1 1831 }
-1 1832 if (!bypass && !val && isNative) {
-1 1833 if (isSelect) {
-1 1834 val = joinSelectedParts(
-1 1835 node,
-1 1836 node.querySelectorAll("option[selected]"),
-1 1837 true
-1 1838 );
-1 1839 } else {
-1 1840 val = node.value;
-1 1841 }
-1 1842 }
-1 1843
-1 1844 return val;
-1 1845 };
-1 1846
-1 1847 var addSpacing = function(s) {
-1 1848 return trim(s).length ? " " + s + " " : " ";
-1 1849 };
-1 1850
-1 1851 var joinSelectedParts = function(node, nOA, isNative, childRoles) {
-1 1852 if (!nOA || !nOA.length) {
-1 1853 return "";
-1 1854 }
-1 1855 var parts = [];
-1 1856 for (var i = 0; i < nOA.length; i++) {
-1 1857 var role = getRole(nOA[i]);
-1 1858 var isValidChildRole = !childRoles || childRoles.indexOf(role) !== -1;
-1 1859 if (isValidChildRole) {
-1 1860 parts.push(
-1 1861 isNative
-1 1862 ? getText(nOA[i])
-1 1863 : walk(nOA[i], true, false, [], false, { top: nOA[i] }).name
-1 1864 );
-1 1865 }
-1 1866 }
-1 1867 return parts.join(" ");
-1 1868 };
-1 1869
-1 1870 var getPseudoElStyleObj = function(node, position) {
-1 1871 var styleObj = {};
-1 1872 for (var prop in blockStyles) {
-1 1873 styleObj[prop] = document.defaultView
-1 1874 .getComputedStyle(node, position)
-1 1875 .getPropertyValue(prop);
-1 1876 }
-1 1877 styleObj["content"] = document.defaultView
-1 1878 .getComputedStyle(node, position)
-1 1879 .getPropertyValue("content")
-1 1880 .replace(/^"|\\|"$/g, "");
-1 1881 return styleObj;
-1 1882 };
-1 1883
-1 1884 var getText = function(node, position) {
-1 1885 if (!position && node.nodeType === 1) {
-1 1886 return node.innerText || node.textContent || "";
-1 1887 }
-1 1888 var styles = getPseudoElStyleObj(node, position);
-1 1889 var text = styles["content"];
-1 1890 if (!text || text === "none") {
-1 1891 return "";
-1 1892 }
-1 1893 if (isBlockLevelElement({}, styles)) {
-1 1894 if (position === ":before") {
-1 1895 text += " ";
-1 1896 } else if (position === ":after") {
-1 1897 text = " " + text;
-1 1898 }
-1 1899 }
-1 1900 return text;
-1 1901 };
-1 1902
-1 1903 var getCSSText = function(node, refNode) {
-1 1904 if (
-1 1905 (node && node.nodeType !== 1) ||
-1 1906 node === refNode ||
-1 1907 ["input", "select", "textarea", "img", "iframe"].indexOf(
-1 1908 node.nodeName.toLowerCase()
-1 1909 ) !== -1
-1 1910 ) {
-1 1911 return { before: "", after: "" };
-1 1912 }
-1 1913 if (document.defaultView && document.defaultView.getComputedStyle) {
-1 1914 return {
-1 1915 before: cleanCSSText(node, getText(node, ":before")),
-1 1916 after: cleanCSSText(node, getText(node, ":after"))
-1 1917 };
-1 1918 } else {
-1 1919 return { before: "", after: "" };
-1 1920 }
-1 1921 };
-1 1922
-1 1923 var getParent = function(node, nTag) {
-1 1924 while (node) {
-1 1925 node = node.parentNode;
-1 1926 if (node && node.nodeName && node.nodeName.toLowerCase() === nTag) {
-1 1927 return node;
-1 1928 }
-1 1929 }
-1 1930 return {};
-1 1931 };
-1 1932
-1 1933 var hasParentLabelOrHidden = function(node, refNode, ownedBy, ignoreHidden) {
-1 1934 var trackNodes = [];
-1 1935 while (node && node !== refNode) {
-1 1936 if (
-1 1937 node.id &&
-1 1938 ownedBy &&
-1 1939 ownedBy[node.id] &&
-1 1940 ownedBy[node.id].node &&
-1 1941 trackNodes.indexOf(node) === -1
-1 1942 ) {
-1 1943 trackNodes.push(node);
-1 1944 node = ownedBy[node.id].node;
-1 1945 } else {
-1 1946 node = node.parentNode;
-1 1947 }
-1 1948 if (node && node.getAttribute) {
-1 1949 if (
-1 1950 trim(node.getAttribute("aria-label")) ||
-1 1951 (!ignoreHidden && isHidden(node, refNode))
-1 1952 ) {
-1 1953 return true;
-1 1954 }
-1 1955 }
-1 1956 }
-1 1957 return false;
-1 1958 };
-1 1959
-1 1960 var trim = function(str) {
-1 1961 if (typeof str !== "string") {
-1 1962 return "";
-1 1963 }
-1 1964 return str.replace(/^\s+|\s+$/g, "");
-1 1965 };
-1 1966
-1 1967 if (isParentHidden(node, document.body, true)) {
-1 1968 return props;
-1 1969 }
-1 1970
-1 1971 // Compute accessible Name and Description properties value for node
-1 1972 var accProps = walk(node, false, false, [], false, { top: node });
-1 1973
-1 1974 var accName = trim(accProps.name.replace(/\s+/g, " "));
-1 1975 var accDesc = trim(accProps.title.replace(/\s+/g, " "));
-1 1976
-1 1977 if (accName === accDesc) {
-1 1978 // If both Name and Description properties match, then clear the Description property value.
-1 1979 accDesc = "";
-1 1980 }
-1 1981
-1 1982 props.name = accName;
-1 1983 props.desc = accDesc;
-1 1984
-1 1985 // Clear track variables
-1 1986 nodes = [];
-1 1987 owns = [];
-1 1988
-1 1989 if (fnc && typeof fnc === "function") {
-1 1990 return fnc.apply(node, [node, props]);
-1 1991 } else {
-1 1992 return props;
-1 1993 }
-1 1994 };
-1 1995
-1 1996 // Customize returned string for testable statements
-1 1997
-1 1998 var getNames = function(node) {
-1 1999 var props = calcNames(node);
-1 2000 return (
-1 2001 'accName: "' +
-1 2002 props.name +
-1 2003 '"\n\naccDesc: "' +
-1 2004 props.desc +
-1 2005 '"\n\n(Running AccName Computation Prototype version: ' +
-1 2006 currentVersion +
-1 2007 ")"
-1 2008 );
-1 2009 };
-1 2010
-1 2011 if (typeof module === "object" && module.exports) {
-1 2012 module.exports = {
-1 2013 getNames: getNames,
-1 2014 calcNames: calcNames
-1 2015 };
-1 2016 }
-1 2017
-1 2018 },{}]},{},[3]);