- commit
- a40c8cd9bbb9a0f256c2d1960081e06b32a44a34
- parent
- df8ce00576d865a56919ea4c1e1a799d89d8fa93
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2020-11-12 12:58
build
Diffstat
| M | babel.js | 1301 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- |
1 files changed, 1272 insertions, 29 deletions
diff --git a/babel.js b/babel.js
@@ -33387,6 +33387,1214 @@ module.exports = {
33387 33387 });
33388 33388 })(typeof window === 'object' ? window : this);
33389 33389 },{}],14:[function(require,module,exports){
-1 33390 "use strict";
-1 33391
-1 33392 exports.__esModule = true;
-1 33393 exports.computeAccessibleDescription = computeAccessibleDescription;
-1 33394
-1 33395 var _accessibleNameAndDescription = require("./accessible-name-and-description");
-1 33396
-1 33397 var _util = require("./util");
-1 33398
-1 33399 function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
-1 33400
-1 33401 function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
-1 33402
-1 33403 function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
-1 33404
-1 33405 /**
-1 33406 * implements https://w3c.github.io/accname/#mapping_additional_nd_description
-1 33407 * @param root
-1 33408 * @param [options]
-1 33409 * @parma [options.getComputedStyle] - mock window.getComputedStyle. Needs `content`, `display` and `visibility`
-1 33410 */
-1 33411 function computeAccessibleDescription(root) {
-1 33412 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
-1 33413 var description = (0, _util.queryIdRefs)(root, "aria-describedby").map(function (element) {
-1 33414 return (0, _accessibleNameAndDescription.computeTextAlternative)(element, _objectSpread(_objectSpread({}, options), {}, {
-1 33415 compute: "description"
-1 33416 }));
-1 33417 }).join(" "); // TODO: Technically we need to make sure that node wasn't used for the accessible name
-1 33418 // This causes `description_1.0_combobox-focusable-manual` to fail
-1 33419 //
-1 33420 // https://www.w3.org/TR/html-aam-1.0/#accessible-name-and-description-computation
-1 33421 // says for so many elements to use the `title` that we assume all elements are considered
-1 33422
-1 33423 if (description === "") {
-1 33424 var title = root.getAttribute("title");
-1 33425 description = title === null ? "" : title;
-1 33426 }
-1 33427
-1 33428 return description;
-1 33429 }
-1 33430
-1 33431 },{"./accessible-name-and-description":15,"./util":21}],15:[function(require,module,exports){
-1 33432 "use strict";
-1 33433
-1 33434 exports.__esModule = true;
-1 33435 exports.computeTextAlternative = computeTextAlternative;
-1 33436
-1 33437 var _array = _interopRequireDefault(require("./polyfills/array.from"));
-1 33438
-1 33439 var _SetLike = _interopRequireDefault(require("./polyfills/SetLike"));
-1 33440
-1 33441 var _util = require("./util");
-1 33442
-1 33443 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-1 33444
-1 33445 /**
-1 33446 * implements https://w3c.github.io/accname/
-1 33447 */
-1 33448
-1 33449 /**
-1 33450 *
-1 33451 * @param {string} string -
-1 33452 * @returns {FlatString} -
-1 33453 */
-1 33454 function asFlatString(s) {
-1 33455 return s.trim().replace(/\s\s+/g, " ");
-1 33456 }
-1 33457 /**
-1 33458 *
-1 33459 * @param node -
-1 33460 * @param options - These are not optional to prevent accidentally calling it without options in `computeAccessibleName`
-1 33461 * @returns {boolean} -
-1 33462 */
-1 33463
-1 33464
-1 33465 function isHidden(node, getComputedStyleImplementation) {
-1 33466 if (!(0, _util.isElement)(node)) {
-1 33467 return false;
-1 33468 }
-1 33469
-1 33470 if (node.hasAttribute("hidden") || node.getAttribute("aria-hidden") === "true") {
-1 33471 return true;
-1 33472 }
-1 33473
-1 33474 var style = getComputedStyleImplementation(node);
-1 33475 return style.getPropertyValue("display") === "none" || style.getPropertyValue("visibility") === "hidden";
-1 33476 }
-1 33477 /**
-1 33478 * @param {Node} node -
-1 33479 * @returns {boolean} - As defined in step 2E of https://w3c.github.io/accname/#mapping_additional_nd_te
-1 33480 */
-1 33481
-1 33482
-1 33483 function isControl(node) {
-1 33484 return (0, _util.hasAnyConcreteRoles)(node, ["button", "combobox", "listbox", "textbox"]) || hasAbstractRole(node, "range");
-1 33485 }
-1 33486
-1 33487 function hasAbstractRole(node, role) {
-1 33488 if (!(0, _util.isElement)(node)) {
-1 33489 return false;
-1 33490 }
-1 33491
-1 33492 switch (role) {
-1 33493 case "range":
-1 33494 return (0, _util.hasAnyConcreteRoles)(node, ["meter", "progressbar", "scrollbar", "slider", "spinbutton"]);
-1 33495
-1 33496 default:
-1 33497 throw new TypeError("No knowledge about abstract role '".concat(role, "'. This is likely a bug :("));
-1 33498 }
-1 33499 }
-1 33500 /**
-1 33501 * element.querySelectorAll but also considers owned tree
-1 33502 * @param element
-1 33503 * @param selectors
-1 33504 */
-1 33505
-1 33506
-1 33507 function querySelectorAllSubtree(element, selectors) {
-1 33508 var elements = (0, _array.default)(element.querySelectorAll(selectors));
-1 33509 (0, _util.queryIdRefs)(element, "aria-owns").forEach(function (root) {
-1 33510 // babel transpiles this assuming an iterator
-1 33511 elements.push.apply(elements, (0, _array.default)(root.querySelectorAll(selectors)));
-1 33512 });
-1 33513 return elements;
-1 33514 }
-1 33515
-1 33516 function querySelectedOptions(listbox) {
-1 33517 if ((0, _util.isHTMLSelectElement)(listbox)) {
-1 33518 // IE11 polyfill
-1 33519 return listbox.selectedOptions || querySelectorAllSubtree(listbox, "[selected]");
-1 33520 }
-1 33521
-1 33522 return querySelectorAllSubtree(listbox, '[aria-selected="true"]');
-1 33523 }
-1 33524
-1 33525 function isMarkedPresentational(node) {
-1 33526 return (0, _util.hasAnyConcreteRoles)(node, ["none", "presentation"]);
-1 33527 }
-1 33528 /**
-1 33529 * Elements specifically listed in html-aam
-1 33530 *
-1 33531 * We don't need this for `label` or `legend` elements.
-1 33532 * Their implicit roles already allow "naming from content".
-1 33533 *
-1 33534 * sources:
-1 33535 *
-1 33536 * - https://w3c.github.io/html-aam/#table-element
-1 33537 */
-1 33538
-1 33539
-1 33540 function isNativeHostLanguageTextAlternativeElement(node) {
-1 33541 return (0, _util.isHTMLTableCaptionElement)(node);
-1 33542 }
-1 33543 /**
-1 33544 * https://w3c.github.io/aria/#namefromcontent
-1 33545 */
-1 33546
-1 33547
-1 33548 function allowsNameFromContent(node) {
-1 33549 return (0, _util.hasAnyConcreteRoles)(node, ["button", "cell", "checkbox", "columnheader", "gridcell", "heading", "label", "legend", "link", "menuitem", "menuitemcheckbox", "menuitemradio", "option", "radio", "row", "rowheader", "switch", "tab", "tooltip", "treeitem"]);
-1 33550 }
-1 33551 /**
-1 33552 * TODO https://github.com/eps1lon/dom-accessibility-api/issues/100
-1 33553 */
-1 33554
-1 33555
-1 33556 function isDescendantOfNativeHostLanguageTextAlternativeElement( // eslint-disable-next-line @typescript-eslint/no-unused-vars -- not implemented yet
-1 33557 node) {
-1 33558 return false;
-1 33559 }
-1 33560 /**
-1 33561 * TODO https://github.com/eps1lon/dom-accessibility-api/issues/101
-1 33562 */
-1 33563 // eslint-disable-next-line @typescript-eslint/no-unused-vars -- not implemented yet
-1 33564
-1 33565
-1 33566 function computeTooltipAttributeValue(node) {
-1 33567 return null;
-1 33568 }
-1 33569
-1 33570 function getValueOfTextbox(element) {
-1 33571 if ((0, _util.isHTMLInputElement)(element) || (0, _util.isHTMLTextAreaElement)(element)) {
-1 33572 return element.value;
-1 33573 } // https://github.com/eps1lon/dom-accessibility-api/issues/4
-1 33574
-1 33575
-1 33576 return element.textContent || "";
-1 33577 }
-1 33578
-1 33579 function getTextualContent(declaration) {
-1 33580 var content = declaration.getPropertyValue("content");
-1 33581
-1 33582 if (/^["'].*["']$/.test(content)) {
-1 33583 return content.slice(1, -1);
-1 33584 }
-1 33585
-1 33586 return "";
-1 33587 }
-1 33588 /**
-1 33589 * https://html.spec.whatwg.org/multipage/forms.html#category-label
-1 33590 * TODO: form-associated custom elements
-1 33591 * @param element
-1 33592 */
-1 33593
-1 33594
-1 33595 function isLabelableElement(element) {
-1 33596 var localName = (0, _util.getLocalName)(element);
-1 33597 return localName === "button" || localName === "input" && element.getAttribute("type") !== "hidden" || localName === "meter" || localName === "output" || localName === "progress" || localName === "select" || localName === "textarea";
-1 33598 }
-1 33599 /**
-1 33600 * > [...], then the first such descendant in tree order is the label element's labeled control.
-1 33601 * -- https://html.spec.whatwg.org/multipage/forms.html#labeled-control
-1 33602 * @param element
-1 33603 */
-1 33604
-1 33605
-1 33606 function findLabelableElement(element) {
-1 33607 if (isLabelableElement(element)) {
-1 33608 return element;
-1 33609 }
-1 33610
-1 33611 var labelableElement = null;
-1 33612 element.childNodes.forEach(function (childNode) {
-1 33613 if (labelableElement === null && (0, _util.isElement)(childNode)) {
-1 33614 var descendantLabelableElement = findLabelableElement(childNode);
-1 33615
-1 33616 if (descendantLabelableElement !== null) {
-1 33617 labelableElement = descendantLabelableElement;
-1 33618 }
-1 33619 }
-1 33620 });
-1 33621 return labelableElement;
-1 33622 }
-1 33623 /**
-1 33624 * Polyfill of HTMLLabelElement.control
-1 33625 * https://html.spec.whatwg.org/multipage/forms.html#labeled-control
-1 33626 * @param label
-1 33627 */
-1 33628
-1 33629
-1 33630 function getControlOfLabel(label) {
-1 33631 if (label.control !== undefined) {
-1 33632 return label.control;
-1 33633 }
-1 33634
-1 33635 var htmlFor = label.getAttribute("for");
-1 33636
-1 33637 if (htmlFor !== null) {
-1 33638 return label.ownerDocument.getElementById(htmlFor);
-1 33639 }
-1 33640
-1 33641 return findLabelableElement(label);
-1 33642 }
-1 33643 /**
-1 33644 * Polyfill of HTMLInputElement.labels
-1 33645 * https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/labels
-1 33646 * @param element
-1 33647 */
-1 33648
-1 33649
-1 33650 function getLabels(element) {
-1 33651 var labelsProperty = element.labels;
-1 33652
-1 33653 if (labelsProperty === null) {
-1 33654 return labelsProperty;
-1 33655 }
-1 33656
-1 33657 if (labelsProperty !== undefined) {
-1 33658 return (0, _array.default)(labelsProperty);
-1 33659 }
-1 33660
-1 33661 if (!isLabelableElement(element)) {
-1 33662 return null;
-1 33663 }
-1 33664
-1 33665 var document = element.ownerDocument;
-1 33666 return (0, _array.default)(document.querySelectorAll("label")).filter(function (label) {
-1 33667 return getControlOfLabel(label) === element;
-1 33668 });
-1 33669 }
-1 33670 /**
-1 33671 * Gets the contents of a slot used for computing the accname
-1 33672 * @param slot
-1 33673 */
-1 33674
-1 33675
-1 33676 function getSlotContents(slot) {
-1 33677 // Computing the accessible name for elements containing slots is not
-1 33678 // currently defined in the spec. This implementation reflects the
-1 33679 // behavior of NVDA 2020.2/Firefox 81 and iOS VoiceOver/Safari 13.6.
-1 33680 var assignedNodes = slot.assignedNodes();
-1 33681
-1 33682 if (assignedNodes.length === 0) {
-1 33683 // if no nodes are assigned to the slot, it displays the default content
-1 33684 return (0, _array.default)(slot.childNodes);
-1 33685 }
-1 33686
-1 33687 return assignedNodes;
-1 33688 }
-1 33689 /**
-1 33690 * implements https://w3c.github.io/accname/#mapping_additional_nd_te
-1 33691 * @param root
-1 33692 * @param [options]
-1 33693 * @param [options.getComputedStyle] - mock window.getComputedStyle. Needs `content`, `display` and `visibility`
-1 33694 */
-1 33695
-1 33696
-1 33697 function computeTextAlternative(root) {
-1 33698 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
-1 33699 var consultedNodes = new _SetLike.default();
-1 33700 var window = (0, _util.safeWindow)(root);
-1 33701 var _options$compute = options.compute,
-1 33702 compute = _options$compute === void 0 ? "name" : _options$compute,
-1 33703 _options$computedStyl = options.computedStyleSupportsPseudoElements,
-1 33704 computedStyleSupportsPseudoElements = _options$computedStyl === void 0 ? options.getComputedStyle !== undefined : _options$computedStyl,
-1 33705 _options$getComputedS = options.getComputedStyle,
-1 33706 getComputedStyle = _options$getComputedS === void 0 ? window.getComputedStyle.bind(window) : _options$getComputedS; // 2F.i
-1 33707
-1 33708 function computeMiscTextAlternative(node, context) {
-1 33709 var accumulatedText = "";
-1 33710
-1 33711 if ((0, _util.isElement)(node) && computedStyleSupportsPseudoElements) {
-1 33712 var pseudoBefore = getComputedStyle(node, "::before");
-1 33713 var beforeContent = getTextualContent(pseudoBefore);
-1 33714 accumulatedText = "".concat(beforeContent, " ").concat(accumulatedText);
-1 33715 } // FIXME: Including aria-owns is not defined in the spec
-1 33716 // But it is required in the web-platform-test
-1 33717
-1 33718
-1 33719 var childNodes = (0, _util.isHTMLSlotElement)(node) ? getSlotContents(node) : (0, _array.default)(node.childNodes).concat((0, _util.queryIdRefs)(node, "aria-owns"));
-1 33720 childNodes.forEach(function (child) {
-1 33721 var result = computeTextAlternative(child, {
-1 33722 isEmbeddedInLabel: context.isEmbeddedInLabel,
-1 33723 isReferenced: false,
-1 33724 recursion: true
-1 33725 }); // TODO: Unclear why display affects delimiter
-1 33726 // see https://github.com/w3c/accname/issues/3
-1 33727
-1 33728 var display = (0, _util.isElement)(child) ? getComputedStyle(child).getPropertyValue("display") : "inline";
-1 33729 var separator = display !== "inline" ? " " : ""; // trailing separator for wpt tests
-1 33730
-1 33731 accumulatedText += "".concat(separator).concat(result).concat(separator);
-1 33732 });
-1 33733
-1 33734 if ((0, _util.isElement)(node) && computedStyleSupportsPseudoElements) {
-1 33735 var pseudoAfter = getComputedStyle(node, "::after");
-1 33736 var afterContent = getTextualContent(pseudoAfter);
-1 33737 accumulatedText = "".concat(accumulatedText, " ").concat(afterContent);
-1 33738 }
-1 33739
-1 33740 return accumulatedText;
-1 33741 }
-1 33742
-1 33743 function computeElementTextAlternative(node) {
-1 33744 if (!(0, _util.isElement)(node)) {
-1 33745 return null;
-1 33746 }
-1 33747 /**
-1 33748 *
-1 33749 * @param element
-1 33750 * @param attributeName
-1 33751 * @returns A string non-empty string or `null`
-1 33752 */
-1 33753
-1 33754
-1 33755 function useAttribute(element, attributeName) {
-1 33756 var attribute = element.getAttributeNode(attributeName);
-1 33757
-1 33758 if (attribute !== null && !consultedNodes.has(attribute) && attribute.value.trim() !== "") {
-1 33759 consultedNodes.add(attribute);
-1 33760 return attribute.value;
-1 33761 }
-1 33762
-1 33763 return null;
-1 33764 } // https://w3c.github.io/html-aam/#fieldset-and-legend-elements
-1 33765
-1 33766
-1 33767 if ((0, _util.isHTMLFieldSetElement)(node)) {
-1 33768 consultedNodes.add(node);
-1 33769 var children = (0, _array.default)(node.childNodes);
-1 33770
-1 33771 for (var i = 0; i < children.length; i += 1) {
-1 33772 var child = children[i];
-1 33773
-1 33774 if ((0, _util.isHTMLLegendElement)(child)) {
-1 33775 return computeTextAlternative(child, {
-1 33776 isEmbeddedInLabel: false,
-1 33777 isReferenced: false,
-1 33778 recursion: false
-1 33779 });
-1 33780 }
-1 33781 }
-1 33782 } else if ((0, _util.isHTMLTableElement)(node)) {
-1 33783 // https://w3c.github.io/html-aam/#table-element
-1 33784 consultedNodes.add(node);
-1 33785
-1 33786 var _children = (0, _array.default)(node.childNodes);
-1 33787
-1 33788 for (var _i = 0; _i < _children.length; _i += 1) {
-1 33789 var _child = _children[_i];
-1 33790
-1 33791 if ((0, _util.isHTMLTableCaptionElement)(_child)) {
-1 33792 return computeTextAlternative(_child, {
-1 33793 isEmbeddedInLabel: false,
-1 33794 isReferenced: false,
-1 33795 recursion: false
-1 33796 });
-1 33797 }
-1 33798 }
-1 33799 } else if ((0, _util.isSVGSVGElement)(node)) {
-1 33800 // https://www.w3.org/TR/svg-aam-1.0/
-1 33801 consultedNodes.add(node);
-1 33802
-1 33803 var _children2 = (0, _array.default)(node.childNodes);
-1 33804
-1 33805 for (var _i2 = 0; _i2 < _children2.length; _i2 += 1) {
-1 33806 var _child2 = _children2[_i2];
-1 33807
-1 33808 if ((0, _util.isSVGTitleElement)(_child2)) {
-1 33809 return _child2.textContent;
-1 33810 }
-1 33811 }
-1 33812
-1 33813 return null;
-1 33814 } else if ((0, _util.getLocalName)(node) === "img" || (0, _util.getLocalName)(node) === "area") {
-1 33815 // https://w3c.github.io/html-aam/#area-element
-1 33816 // https://w3c.github.io/html-aam/#img-element
-1 33817 var nameFromAlt = useAttribute(node, "alt");
-1 33818
-1 33819 if (nameFromAlt !== null) {
-1 33820 return nameFromAlt;
-1 33821 }
-1 33822 }
-1 33823
-1 33824 if ((0, _util.isHTMLInputElement)(node) && (node.type === "button" || node.type === "submit" || node.type === "reset")) {
-1 33825 // https://w3c.github.io/html-aam/#input-type-text-input-type-password-input-type-search-input-type-tel-input-type-email-input-type-url-and-textarea-element-accessible-description-computation
-1 33826 var nameFromValue = useAttribute(node, "value");
-1 33827
-1 33828 if (nameFromValue !== null) {
-1 33829 return nameFromValue;
-1 33830 } // TODO: l10n
-1 33831
-1 33832
-1 33833 if (node.type === "submit") {
-1 33834 return "Submit";
-1 33835 } // TODO: l10n
-1 33836
-1 33837
-1 33838 if (node.type === "reset") {
-1 33839 return "Reset";
-1 33840 }
-1 33841 }
-1 33842
-1 33843 if ((0, _util.isHTMLInputElement)(node) || (0, _util.isHTMLSelectElement)(node) || (0, _util.isHTMLTextAreaElement)(node)) {
-1 33844 var input = node;
-1 33845 var labels = getLabels(input);
-1 33846
-1 33847 if (labels !== null && labels.length !== 0) {
-1 33848 consultedNodes.add(input);
-1 33849 return (0, _array.default)(labels).map(function (element) {
-1 33850 return computeTextAlternative(element, {
-1 33851 isEmbeddedInLabel: true,
-1 33852 isReferenced: false,
-1 33853 recursion: true
-1 33854 });
-1 33855 }).filter(function (label) {
-1 33856 return label.length > 0;
-1 33857 }).join(" ");
-1 33858 }
-1 33859 } // https://w3c.github.io/html-aam/#input-type-image-accessible-name-computation
-1 33860 // TODO: wpt test consider label elements but html-aam does not mention them
-1 33861 // We follow existing implementations over spec
-1 33862
-1 33863
-1 33864 if ((0, _util.isHTMLInputElement)(node) && node.type === "image") {
-1 33865 var _nameFromAlt = useAttribute(node, "alt");
-1 33866
-1 33867 if (_nameFromAlt !== null) {
-1 33868 return _nameFromAlt;
-1 33869 }
-1 33870
-1 33871 var nameFromTitle = useAttribute(node, "title");
-1 33872
-1 33873 if (nameFromTitle !== null) {
-1 33874 return nameFromTitle;
-1 33875 } // TODO: l10n
-1 33876
-1 33877
-1 33878 return "Submit Query";
-1 33879 }
-1 33880
-1 33881 return useAttribute(node, "title");
-1 33882 }
-1 33883
-1 33884 function computeTextAlternative(current, context) {
-1 33885 if (consultedNodes.has(current)) {
-1 33886 return "";
-1 33887 } // special casing, cheating to make tests pass
-1 33888 // https://github.com/w3c/accname/issues/67
-1 33889
-1 33890
-1 33891 if ((0, _util.hasAnyConcreteRoles)(current, ["menu"])) {
-1 33892 consultedNodes.add(current);
-1 33893 return "";
-1 33894 } // 2A
-1 33895
-1 33896
-1 33897 if (isHidden(current, getComputedStyle) && !context.isReferenced) {
-1 33898 consultedNodes.add(current);
-1 33899 return "";
-1 33900 } // 2B
-1 33901
-1 33902
-1 33903 var labelElements = (0, _util.queryIdRefs)(current, "aria-labelledby");
-1 33904
-1 33905 if (compute === "name" && !context.isReferenced && labelElements.length > 0) {
-1 33906 return labelElements.map(function (element) {
-1 33907 return computeTextAlternative(element, {
-1 33908 isEmbeddedInLabel: context.isEmbeddedInLabel,
-1 33909 isReferenced: true,
-1 33910 // thais isn't recursion as specified, otherwise we would skip
-1 33911 // `aria-label` in
-1 33912 // <input id="myself" aria-label="foo" aria-labelledby="myself"
-1 33913 recursion: false
-1 33914 });
-1 33915 }).join(" ");
-1 33916 } // 2C
-1 33917 // Changed from the spec in anticipation of https://github.com/w3c/accname/issues/64
-1 33918 // spec says we should only consider skipping if we have a non-empty label
-1 33919
-1 33920
-1 33921 var skipToStep2E = context.recursion && isControl(current) && compute === "name";
-1 33922
-1 33923 if (!skipToStep2E) {
-1 33924 var ariaLabel = ((0, _util.isElement)(current) && current.getAttribute("aria-label") || "").trim();
-1 33925
-1 33926 if (ariaLabel !== "" && compute === "name") {
-1 33927 consultedNodes.add(current);
-1 33928 return ariaLabel;
-1 33929 } // 2D
-1 33930
-1 33931
-1 33932 if (!isMarkedPresentational(current)) {
-1 33933 var elementTextAlternative = computeElementTextAlternative(current);
-1 33934
-1 33935 if (elementTextAlternative !== null) {
-1 33936 consultedNodes.add(current);
-1 33937 return elementTextAlternative;
-1 33938 }
-1 33939 }
-1 33940 } // 2E
-1 33941
-1 33942
-1 33943 if (skipToStep2E || context.isEmbeddedInLabel || context.isReferenced) {
-1 33944 if ((0, _util.hasAnyConcreteRoles)(current, ["combobox", "listbox"])) {
-1 33945 consultedNodes.add(current);
-1 33946 var selectedOptions = querySelectedOptions(current);
-1 33947
-1 33948 if (selectedOptions.length === 0) {
-1 33949 // defined per test `name_heading_combobox`
-1 33950 return (0, _util.isHTMLInputElement)(current) ? current.value : "";
-1 33951 }
-1 33952
-1 33953 return (0, _array.default)(selectedOptions).map(function (selectedOption) {
-1 33954 return computeTextAlternative(selectedOption, {
-1 33955 isEmbeddedInLabel: context.isEmbeddedInLabel,
-1 33956 isReferenced: false,
-1 33957 recursion: true
-1 33958 });
-1 33959 }).join(" ");
-1 33960 }
-1 33961
-1 33962 if (hasAbstractRole(current, "range")) {
-1 33963 consultedNodes.add(current);
-1 33964
-1 33965 if (current.hasAttribute("aria-valuetext")) {
-1 33966 // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- safe due to hasAttribute guard
-1 33967 return current.getAttribute("aria-valuetext");
-1 33968 }
-1 33969
-1 33970 if (current.hasAttribute("aria-valuenow")) {
-1 33971 // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- safe due to hasAttribute guard
-1 33972 return current.getAttribute("aria-valuenow");
-1 33973 } // Otherwise, use the value as specified by a host language attribute.
-1 33974
-1 33975
-1 33976 return current.getAttribute("value") || "";
-1 33977 }
-1 33978
-1 33979 if ((0, _util.hasAnyConcreteRoles)(current, ["textbox"])) {
-1 33980 consultedNodes.add(current);
-1 33981 return getValueOfTextbox(current);
-1 33982 }
-1 33983 } // 2F: https://w3c.github.io/accname/#step2F
-1 33984
-1 33985
-1 33986 if (allowsNameFromContent(current) || (0, _util.isElement)(current) && context.isReferenced || isNativeHostLanguageTextAlternativeElement(current) || isDescendantOfNativeHostLanguageTextAlternativeElement(current)) {
-1 33987 consultedNodes.add(current);
-1 33988 return computeMiscTextAlternative(current, {
-1 33989 isEmbeddedInLabel: context.isEmbeddedInLabel,
-1 33990 isReferenced: false
-1 33991 });
-1 33992 }
-1 33993
-1 33994 if (current.nodeType === current.TEXT_NODE) {
-1 33995 consultedNodes.add(current);
-1 33996 return current.textContent || "";
-1 33997 }
-1 33998
-1 33999 if (context.recursion) {
-1 34000 consultedNodes.add(current);
-1 34001 return computeMiscTextAlternative(current, {
-1 34002 isEmbeddedInLabel: context.isEmbeddedInLabel,
-1 34003 isReferenced: false
-1 34004 });
-1 34005 }
-1 34006
-1 34007 var tooltipAttributeValue = computeTooltipAttributeValue(current);
-1 34008
-1 34009 if (tooltipAttributeValue !== null) {
-1 34010 consultedNodes.add(current);
-1 34011 return tooltipAttributeValue;
-1 34012 } // TODO should this be reachable?
-1 34013
-1 34014
-1 34015 consultedNodes.add(current);
-1 34016 return "";
-1 34017 }
-1 34018
-1 34019 return asFlatString(computeTextAlternative(root, {
-1 34020 isEmbeddedInLabel: false,
-1 34021 // by spec computeAccessibleDescription starts with the referenced elements as roots
-1 34022 isReferenced: compute === "description",
-1 34023 recursion: false
-1 34024 }));
-1 34025 }
-1 34026
-1 34027 },{"./polyfills/SetLike":19,"./polyfills/array.from":20,"./util":21}],16:[function(require,module,exports){
-1 34028 "use strict";
-1 34029
-1 34030 exports.__esModule = true;
-1 34031 exports.computeAccessibleName = computeAccessibleName;
-1 34032
-1 34033 var _accessibleNameAndDescription = require("./accessible-name-and-description");
-1 34034
-1 34035 var _util = require("./util");
-1 34036
-1 34037 /**
-1 34038 * https://w3c.github.io/aria/#namefromprohibited
-1 34039 */
-1 34040 function prohibitsNaming(node) {
-1 34041 return (0, _util.hasAnyConcreteRoles)(node, ["caption", "code", "deletion", "emphasis", "generic", "insertion", "paragraph", "presentation", "strong", "subscript", "superscript"]);
-1 34042 }
-1 34043 /**
-1 34044 * implements https://w3c.github.io/accname/#mapping_additional_nd_name
-1 34045 * @param root
-1 34046 * @param [options]
-1 34047 * @parma [options.getComputedStyle] - mock window.getComputedStyle. Needs `content`, `display` and `visibility`
-1 34048 */
-1 34049
-1 34050
-1 34051 function computeAccessibleName(root) {
-1 34052 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
-1 34053
-1 34054 if (prohibitsNaming(root)) {
-1 34055 return "";
-1 34056 }
-1 34057
-1 34058 return (0, _accessibleNameAndDescription.computeTextAlternative)(root, options);
-1 34059 }
-1 34060
-1 34061 },{"./accessible-name-and-description":15,"./util":21}],17:[function(require,module,exports){
-1 34062 "use strict";
-1 34063
-1 34064 exports.__esModule = true;
-1 34065 exports.default = getRole;
-1 34066
-1 34067 var _util = require("./util");
-1 34068
-1 34069 function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
-1 34070
-1 34071 function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
-1 34072
-1 34073 function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
-1 34074
-1 34075 function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
-1 34076
-1 34077 function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
-1 34078
-1 34079 function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
-1 34080
-1 34081 var localNameToRoleMappings = {
-1 34082 article: "article",
-1 34083 aside: "complementary",
-1 34084 body: "document",
-1 34085 button: "button",
-1 34086 datalist: "listbox",
-1 34087 dd: "definition",
-1 34088 details: "group",
-1 34089 dialog: "dialog",
-1 34090 dt: "term",
-1 34091 fieldset: "group",
-1 34092 figure: "figure",
-1 34093 // WARNING: Only with an accessible name
-1 34094 form: "form",
-1 34095 footer: "contentinfo",
-1 34096 h1: "heading",
-1 34097 h2: "heading",
-1 34098 h3: "heading",
-1 34099 h4: "heading",
-1 34100 h5: "heading",
-1 34101 h6: "heading",
-1 34102 header: "banner",
-1 34103 hr: "separator",
-1 34104 legend: "legend",
-1 34105 li: "listitem",
-1 34106 math: "math",
-1 34107 main: "main",
-1 34108 menu: "list",
-1 34109 nav: "navigation",
-1 34110 ol: "list",
-1 34111 optgroup: "group",
-1 34112 // WARNING: Only in certain context
-1 34113 option: "option",
-1 34114 output: "status",
-1 34115 progress: "progressbar",
-1 34116 // WARNING: Only with an accessible name
-1 34117 section: "region",
-1 34118 summary: "button",
-1 34119 table: "table",
-1 34120 tbody: "rowgroup",
-1 34121 textarea: "textbox",
-1 34122 tfoot: "rowgroup",
-1 34123 // WARNING: Only in certain context
-1 34124 td: "cell",
-1 34125 th: "columnheader",
-1 34126 thead: "rowgroup",
-1 34127 tr: "row",
-1 34128 ul: "list"
-1 34129 };
-1 34130 var prohibitedAttributes = {
-1 34131 caption: new Set(["aria-label", "aria-labelledby"]),
-1 34132 code: new Set(["aria-label", "aria-labelledby"]),
-1 34133 deletion: new Set(["aria-label", "aria-labelledby"]),
-1 34134 emphasis: new Set(["aria-label", "aria-labelledby"]),
-1 34135 generic: new Set(["aria-label", "aria-labelledby", "aria-roledescription"]),
-1 34136 insertion: new Set(["aria-label", "aria-labelledby"]),
-1 34137 paragraph: new Set(["aria-label", "aria-labelledby"]),
-1 34138 presentation: new Set(["aria-label", "aria-labelledby"]),
-1 34139 strong: new Set(["aria-label", "aria-labelledby"]),
-1 34140 subscript: new Set(["aria-label", "aria-labelledby"]),
-1 34141 superscript: new Set(["aria-label", "aria-labelledby"])
-1 34142 };
-1 34143 /**
-1 34144 *
-1 34145 * @param element
-1 34146 * @param role The role used for this element. This is specified to control whether you want to use the implicit or explicit role.
-1 34147 */
-1 34148
-1 34149 function hasGlobalAriaAttributes(element, role) {
-1 34150 // https://rawgit.com/w3c/aria/stable/#global_states
-1 34151 // commented attributes are deprecated
-1 34152 return ["aria-atomic", "aria-busy", "aria-controls", "aria-current", "aria-describedby", "aria-details", // "disabled",
-1 34153 "aria-dropeffect", // "errormessage",
-1 34154 "aria-flowto", "aria-grabbed", // "haspopup",
-1 34155 "aria-hidden", // "invalid",
-1 34156 "aria-keyshortcuts", "aria-label", "aria-labelledby", "aria-live", "aria-owns", "aria-relevant", "aria-roledescription"].some(function (attributeName) {
-1 34157 var _prohibitedAttributes;
-1 34158
-1 34159 return element.hasAttribute(attributeName) && !((_prohibitedAttributes = prohibitedAttributes[role]) === null || _prohibitedAttributes === void 0 ? void 0 : _prohibitedAttributes.has(attributeName));
-1 34160 });
-1 34161 }
-1 34162
-1 34163 function ignorePresentationalRole(element, implicitRole) {
-1 34164 // https://rawgit.com/w3c/aria/stable/#conflict_resolution_presentation_none
-1 34165 return hasGlobalAriaAttributes(element, implicitRole);
-1 34166 }
-1 34167
-1 34168 function getRole(element) {
-1 34169 var explicitRole = getExplicitRole(element);
-1 34170
-1 34171 if (explicitRole === null || explicitRole === "presentation") {
-1 34172 var implicitRole = getImplicitRole(element);
-1 34173
-1 34174 if (explicitRole !== "presentation" || ignorePresentationalRole(element, implicitRole || "")) {
-1 34175 return implicitRole;
-1 34176 }
-1 34177 }
-1 34178
-1 34179 return explicitRole;
-1 34180 }
-1 34181
-1 34182 function getImplicitRole(element) {
-1 34183 var mappedByTag = localNameToRoleMappings[(0, _util.getLocalName)(element)];
-1 34184
-1 34185 if (mappedByTag !== undefined) {
-1 34186 return mappedByTag;
-1 34187 }
-1 34188
-1 34189 switch ((0, _util.getLocalName)(element)) {
-1 34190 case "a":
-1 34191 case "area":
-1 34192 case "link":
-1 34193 if (element.hasAttribute("href")) {
-1 34194 return "link";
-1 34195 }
-1 34196
-1 34197 break;
-1 34198
-1 34199 case "img":
-1 34200 if (element.getAttribute("alt") === "" && !ignorePresentationalRole(element, "img")) {
-1 34201 return "presentation";
-1 34202 }
-1 34203
-1 34204 return "img";
-1 34205
-1 34206 case "input":
-1 34207 {
-1 34208 var _ref = element,
-1 34209 type = _ref.type;
-1 34210
-1 34211 switch (type) {
-1 34212 case "button":
-1 34213 case "image":
-1 34214 case "reset":
-1 34215 case "submit":
-1 34216 return "button";
-1 34217
-1 34218 case "checkbox":
-1 34219 case "radio":
-1 34220 return type;
-1 34221
-1 34222 case "range":
-1 34223 return "slider";
-1 34224
-1 34225 case "email":
-1 34226 case "tel":
-1 34227 case "text":
-1 34228 case "url":
-1 34229 if (element.hasAttribute("list")) {
-1 34230 return "combobox";
-1 34231 }
-1 34232
-1 34233 return "textbox";
-1 34234
-1 34235 case "search":
-1 34236 if (element.hasAttribute("list")) {
-1 34237 return "combobox";
-1 34238 }
-1 34239
-1 34240 return "searchbox";
-1 34241
-1 34242 default:
-1 34243 return null;
-1 34244 }
-1 34245 }
-1 34246
-1 34247 case "select":
-1 34248 if (element.hasAttribute("multiple") || element.size > 1) {
-1 34249 return "listbox";
-1 34250 }
-1 34251
-1 34252 return "combobox";
-1 34253 }
-1 34254
-1 34255 return null;
-1 34256 }
-1 34257
-1 34258 function getExplicitRole(element) {
-1 34259 if (element.hasAttribute("role")) {
-1 34260 // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- safe due to hasAttribute check
-1 34261 var _trim$split = element.getAttribute("role").trim().split(" "),
-1 34262 _trim$split2 = _slicedToArray(_trim$split, 1),
-1 34263 explicitRole = _trim$split2[0];
-1 34264
-1 34265 if (explicitRole !== undefined && explicitRole.length > 0) {
-1 34266 return explicitRole;
-1 34267 }
-1 34268 }
-1 34269
-1 34270 return null;
-1 34271 }
-1 34272
-1 34273 },{"./util":21}],18:[function(require,module,exports){
-1 34274 "use strict";
-1 34275
-1 34276 exports.__esModule = true;
-1 34277 exports.getRole = exports.computeAccessibleName = exports.computeAccessibleDescription = void 0;
-1 34278
-1 34279 var _accessibleDescription = require("./accessible-description");
-1 34280
-1 34281 exports.computeAccessibleDescription = _accessibleDescription.computeAccessibleDescription;
-1 34282
-1 34283 var _accessibleName = require("./accessible-name");
-1 34284
-1 34285 exports.computeAccessibleName = _accessibleName.computeAccessibleName;
-1 34286
-1 34287 var _getRole = _interopRequireDefault(require("./getRole"));
-1 34288
-1 34289 exports.getRole = _getRole.default;
-1 34290
-1 34291 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-1 34292
-1 34293 },{"./accessible-description":14,"./accessible-name":16,"./getRole":17}],19:[function(require,module,exports){
-1 34294 "use strict";
-1 34295
-1 34296 exports.__esModule = true;
-1 34297 exports.default = void 0;
-1 34298
-1 34299 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-1 34300
-1 34301 function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
-1 34302
-1 34303 function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
-1 34304
-1 34305 function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
-1 34306
-1 34307 // for environments without Set we fallback to arrays with unique members
-1 34308 var SetLike = /*#__PURE__*/function () {
-1 34309 function SetLike() {
-1 34310 var items = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
-1 34311
-1 34312 _classCallCheck(this, SetLike);
-1 34313
-1 34314 _defineProperty(this, "items", void 0);
-1 34315
-1 34316 this.items = items;
-1 34317 }
-1 34318
-1 34319 _createClass(SetLike, [{
-1 34320 key: "add",
-1 34321 value: function add(value) {
-1 34322 if (this.has(value) === false) {
-1 34323 this.items.push(value);
-1 34324 }
-1 34325
-1 34326 return this;
-1 34327 }
-1 34328 }, {
-1 34329 key: "clear",
-1 34330 value: function clear() {
-1 34331 this.items = [];
-1 34332 }
-1 34333 }, {
-1 34334 key: "delete",
-1 34335 value: function _delete(value) {
-1 34336 var previousLength = this.items.length;
-1 34337 this.items = this.items.filter(function (item) {
-1 34338 return item !== value;
-1 34339 });
-1 34340 return previousLength !== this.items.length;
-1 34341 }
-1 34342 }, {
-1 34343 key: "forEach",
-1 34344 value: function forEach(callbackfn) {
-1 34345 var _this = this;
-1 34346
-1 34347 this.items.forEach(function (item) {
-1 34348 callbackfn(item, item, _this);
-1 34349 });
-1 34350 }
-1 34351 }, {
-1 34352 key: "has",
-1 34353 value: function has(value) {
-1 34354 return this.items.indexOf(value) !== -1;
-1 34355 }
-1 34356 }, {
-1 34357 key: "size",
-1 34358 get: function get() {
-1 34359 return this.items.length;
-1 34360 }
-1 34361 }]);
-1 34362
-1 34363 return SetLike;
-1 34364 }();
-1 34365
-1 34366 var _default = typeof Set === "undefined" ? Set : SetLike;
-1 34367
-1 34368 exports.default = _default;
-1 34369
-1 34370 },{}],20:[function(require,module,exports){
-1 34371 "use strict";
-1 34372
-1 34373 exports.__esModule = true;
-1 34374 exports.default = arrayFrom;
-1 34375
-1 34376 /**
-1 34377 * @source {https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from#Polyfill}
-1 34378 * but without thisArg (too hard to type, no need to `this`)
-1 34379 */
-1 34380 var toStr = Object.prototype.toString;
-1 34381
-1 34382 function isCallable(fn) {
-1 34383 return typeof fn === "function" || toStr.call(fn) === "[object Function]";
-1 34384 }
-1 34385
-1 34386 function toInteger(value) {
-1 34387 var number = Number(value);
-1 34388
-1 34389 if (isNaN(number)) {
-1 34390 return 0;
-1 34391 }
-1 34392
-1 34393 if (number === 0 || !isFinite(number)) {
-1 34394 return number;
-1 34395 }
-1 34396
-1 34397 return (number > 0 ? 1 : -1) * Math.floor(Math.abs(number));
-1 34398 }
-1 34399
-1 34400 var maxSafeInteger = Math.pow(2, 53) - 1;
-1 34401
-1 34402 function toLength(value) {
-1 34403 var len = toInteger(value);
-1 34404 return Math.min(Math.max(len, 0), maxSafeInteger);
-1 34405 }
-1 34406 /**
-1 34407 * Creates an array from an iterable object.
-1 34408 * @param iterable An iterable object to convert to an array.
-1 34409 */
-1 34410
-1 34411
-1 34412 /**
-1 34413 * Creates an array from an iterable object.
-1 34414 * @param iterable An iterable object to convert to an array.
-1 34415 * @param mapfn A mapping function to call on every element of the array.
-1 34416 * @param thisArg Value of 'this' used to invoke the mapfn.
-1 34417 */
-1 34418 function arrayFrom(arrayLike, mapFn) {
-1 34419 // 1. Let C be the this value.
-1 34420 // edit(@eps1lon): we're not calling it as Array.from
-1 34421 var C = Array; // 2. Let items be ToObject(arrayLike).
-1 34422
-1 34423 var items = Object(arrayLike); // 3. ReturnIfAbrupt(items).
-1 34424
-1 34425 if (arrayLike == null) {
-1 34426 throw new TypeError("Array.from requires an array-like object - not null or undefined");
-1 34427 } // 4. If mapfn is undefined, then let mapping be false.
-1 34428 // const mapFn = arguments.length > 1 ? arguments[1] : void undefined;
-1 34429
-1 34430
-1 34431 if (typeof mapFn !== "undefined") {
-1 34432 // 5. else
-1 34433 // 5. a If IsCallable(mapfn) is false, throw a TypeError exception.
-1 34434 if (!isCallable(mapFn)) {
-1 34435 throw new TypeError("Array.from: when provided, the second argument must be a function");
-1 34436 }
-1 34437 } // 10. Let lenValue be Get(items, "length").
-1 34438 // 11. Let len be ToLength(lenValue).
-1 34439
-1 34440
-1 34441 var len = toLength(items.length); // 13. If IsConstructor(C) is true, then
-1 34442 // 13. a. Let A be the result of calling the [[Construct]] internal method
-1 34443 // of C with an argument list containing the single item len.
-1 34444 // 14. a. Else, Let A be ArrayCreate(len).
-1 34445
-1 34446 var A = isCallable(C) ? Object(new C(len)) : new Array(len); // 16. Let k be 0.
-1 34447
-1 34448 var k = 0; // 17. Repeat, while k < len… (also steps a - h)
-1 34449
-1 34450 var kValue;
-1 34451
-1 34452 while (k < len) {
-1 34453 kValue = items[k];
-1 34454
-1 34455 if (mapFn) {
-1 34456 A[k] = mapFn(kValue, k);
-1 34457 } else {
-1 34458 A[k] = kValue;
-1 34459 }
-1 34460
-1 34461 k += 1;
-1 34462 } // 18. Let putStatus be Put(A, "length", len, true).
-1 34463
-1 34464
-1 34465 A.length = len; // 20. Return A.
-1 34466
-1 34467 return A;
-1 34468 }
-1 34469
-1 34470 },{}],21:[function(require,module,exports){
-1 34471 "use strict";
-1 34472
-1 34473 exports.__esModule = true;
-1 34474 exports.getLocalName = getLocalName;
-1 34475 exports.isElement = isElement;
-1 34476 exports.isHTMLTableCaptionElement = isHTMLTableCaptionElement;
-1 34477 exports.isHTMLInputElement = isHTMLInputElement;
-1 34478 exports.isHTMLSelectElement = isHTMLSelectElement;
-1 34479 exports.isHTMLTableElement = isHTMLTableElement;
-1 34480 exports.isHTMLTextAreaElement = isHTMLTextAreaElement;
-1 34481 exports.safeWindow = safeWindow;
-1 34482 exports.isHTMLFieldSetElement = isHTMLFieldSetElement;
-1 34483 exports.isHTMLLegendElement = isHTMLLegendElement;
-1 34484 exports.isHTMLSlotElement = isHTMLSlotElement;
-1 34485 exports.isSVGElement = isSVGElement;
-1 34486 exports.isSVGSVGElement = isSVGSVGElement;
-1 34487 exports.isSVGTitleElement = isSVGTitleElement;
-1 34488 exports.queryIdRefs = queryIdRefs;
-1 34489 exports.hasAnyConcreteRoles = hasAnyConcreteRoles;
-1 34490
-1 34491 var _getRole = _interopRequireDefault(require("./getRole"));
-1 34492
-1 34493 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-1 34494
-1 34495 /**
-1 34496 * Safe Element.localName for all supported environments
-1 34497 * @param element
-1 34498 */
-1 34499 function getLocalName(element) {
-1 34500 var _element$localName;
-1 34501
-1 34502 return (// eslint-disable-next-line no-restricted-properties -- actual guard for environments without localName
-1 34503 (_element$localName = element.localName) !== null && _element$localName !== void 0 ? _element$localName : // eslint-disable-next-line no-restricted-properties -- required for the fallback
-1 34504 element.tagName.toLowerCase()
-1 34505 );
-1 34506 }
-1 34507
-1 34508 function isElement(node) {
-1 34509 return node !== null && node.nodeType === node.ELEMENT_NODE;
-1 34510 }
-1 34511
-1 34512 function isHTMLTableCaptionElement(node) {
-1 34513 return isElement(node) && getLocalName(node) === "caption";
-1 34514 }
-1 34515
-1 34516 function isHTMLInputElement(node) {
-1 34517 return isElement(node) && getLocalName(node) === "input";
-1 34518 }
-1 34519
-1 34520 function isHTMLSelectElement(node) {
-1 34521 return isElement(node) && getLocalName(node) === "select";
-1 34522 }
-1 34523
-1 34524 function isHTMLTableElement(node) {
-1 34525 return isElement(node) && getLocalName(node) === "table";
-1 34526 }
-1 34527
-1 34528 function isHTMLTextAreaElement(node) {
-1 34529 return isElement(node) && getLocalName(node) === "textarea";
-1 34530 }
-1 34531
-1 34532 function safeWindow(node) {
-1 34533 var _ref = node.ownerDocument === null ? node : node.ownerDocument,
-1 34534 defaultView = _ref.defaultView;
-1 34535
-1 34536 if (defaultView === null) {
-1 34537 throw new TypeError("no window available");
-1 34538 }
-1 34539
-1 34540 return defaultView;
-1 34541 }
-1 34542
-1 34543 function isHTMLFieldSetElement(node) {
-1 34544 return isElement(node) && getLocalName(node) === "fieldset";
-1 34545 }
-1 34546
-1 34547 function isHTMLLegendElement(node) {
-1 34548 return isElement(node) && getLocalName(node) === "legend";
-1 34549 }
-1 34550
-1 34551 function isHTMLSlotElement(node) {
-1 34552 return isElement(node) && getLocalName(node) === "slot";
-1 34553 }
-1 34554
-1 34555 function isSVGElement(node) {
-1 34556 return isElement(node) && node.ownerSVGElement !== undefined;
-1 34557 }
-1 34558
-1 34559 function isSVGSVGElement(node) {
-1 34560 return isElement(node) && getLocalName(node) === "svg";
-1 34561 }
-1 34562
-1 34563 function isSVGTitleElement(node) {
-1 34564 return isSVGElement(node) && getLocalName(node) === "title";
-1 34565 }
-1 34566 /**
-1 34567 *
-1 34568 * @param {Node} node -
-1 34569 * @param {string} attributeName -
-1 34570 * @returns {Element[]} -
-1 34571 */
-1 34572
-1 34573
-1 34574 function queryIdRefs(node, attributeName) {
-1 34575 if (isElement(node) && node.hasAttribute(attributeName)) {
-1 34576 // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- safe due to hasAttribute check
-1 34577 var ids = node.getAttribute(attributeName).split(" ");
-1 34578 return ids.map(function (id) {
-1 34579 return node.ownerDocument.getElementById(id);
-1 34580 }).filter(function (element) {
-1 34581 return element !== null;
-1 34582 } // TODO: why does this not narrow?
-1 34583 );
-1 34584 }
-1 34585
-1 34586 return [];
-1 34587 }
-1 34588
-1 34589 function hasAnyConcreteRoles(node, roles) {
-1 34590 if (isElement(node)) {
-1 34591 return roles.indexOf((0, _getRole.default)(node)) !== -1;
-1 34592 }
-1 34593
-1 34594 return false;
-1 34595 }
-1 34596
-1 34597 },{"./getRole":17}],22:[function(require,module,exports){
33390 34598 /*!
33391 34599 CalcNames: The AccName Computation Prototype, compute the Name and Description property values for a DOM node
33392 34600 Returns an object with 'name' and 'desc' properties.
@@ -33395,7 +34603,6 @@ http://www.w3.org/TR/accname-aam-1.1/
33395 34603 Authored by Bryan Garaventa, plus refactoring contrabutions by Tobias Bengfort
33396 34604 https://github.com/whatsock/w3c-alternative-text-computation
33397 34605 Distributed under the terms of the Open Source Initiative OSI - MIT License
33398 -1 11:33 AM Thursday, May 7, 2020
33399 34606 */
33400 34607
33401 34608 (function() {
@@ -33404,7 +34611,7 @@ Distributed under the terms of the Open Source Initiative OSI - MIT License
33404 34611 window[nameSpace] = {};
33405 34612 nameSpace = window[nameSpace];
33406 34613 }
33407 -1 nameSpace.getAccNameVersion = "2.49";
-1 34614 nameSpace.getAccNameVersion = "2.50";
33408 34615 // AccName Computation Prototype
33409 34616 nameSpace.getAccName = nameSpace.calcNames = function(
33410 34617 node,
@@ -33422,7 +34629,7 @@ Distributed under the terms of the Open Source Initiative OSI - MIT License
33422 34629 return props;
33423 34630 }
33424 34631 var rootNode = node;
33425 -1
-1 34632 var rootRole = trim(node.getAttribute("role") || "");
33426 34633 // Track nodes to prevent duplicate node reference parsing.
33427 34634 var nodes = [];
33428 34635 // Track aria-owns references to prevent duplicate parsing.
@@ -33881,7 +35088,7 @@ Plus roles extended for the Role Parity project.
33881 35088 (!skipTo.tag &&
33882 35089 !skipTo.role &&
33883 35090 isNativeButton &&
33884 -1 node.getAttribute("type")) ||
-1 35091 (node.getAttribute("type") || "").toLowerCase()) ||
33885 35092 false;
33886 35093 var btnValue =
33887 35094 (!skipTo.tag &&
@@ -34181,7 +35388,9 @@ Plus roles extended for the Role Parity project.
34181 35388 result.title = trim(nTitle);
34182 35389 }
34183 35390
34184 -1 var nType = isNativeFormField && trim(node.getAttribute("type"));
-1 35391 var nType =
-1 35392 isNativeFormField &&
-1 35393 trim(node.getAttribute("type") || "").toLowerCase();
34185 35394 if (!nType) nType = "text";
34186 35395 var placeholder =
34187 35396 !skipTo.tag &&
@@ -34330,7 +35539,10 @@ Plus roles extended for the Role Parity project.
34330 35539 };
34331 35540
34332 35541 var getRole = function(node) {
34333 -1 var role = node && node.getAttribute ? node.getAttribute("role") : "";
-1 35542 var role =
-1 35543 node && node.getAttribute
-1 35544 ? (node.getAttribute("role") || "").toLowerCase()
-1 35545 : "";
34334 35546 if (!trim(role)) {
34335 35547 return "";
34336 35548 }
@@ -34363,7 +35575,7 @@ Plus roles extended for the Role Parity project.
34363 35575 }
34364 35576 return (
34365 35577 ["button", "input", "select", "textarea"].indexOf(nodeName) !== -1 &&
34366 -1 node.getAttribute("type") !== "hidden"
-1 35578 (node.getAttribute("type") || "").toLowerCase() !== "hidden"
34367 35579 );
34368 35580 };
34369 35581
@@ -34902,13 +36114,6 @@ Plus roles extended for the Role Parity project.
34902 36114 return false;
34903 36115 };
34904 36116
34905 -1 var trim = function(str) {
34906 -1 if (typeof str !== "string") {
34907 -1 return "";
34908 -1 }
34909 -1 return str.replace(/^\s+|\s+$/g, "");
34910 -1 };
34911 -1
34912 36117 if (
34913 36118 isParentHidden(
34914 36119 node,
@@ -34931,6 +36136,8 @@ Plus roles extended for the Role Parity project.
34931 36136 accDesc = "";
34932 36137 }
34933 36138
-1 36139 props.hasUpperCase =
-1 36140 rootRole && rootRole !== rootRole.toLowerCase() ? true : false;
34934 36141 props.name = accName;
34935 36142 props.desc = accDesc;
34936 36143
@@ -34950,6 +36157,13 @@ Plus roles extended for the Role Parity project.
34950 36157 }
34951 36158 };
34952 36159
-1 36160 var trim = function(str) {
-1 36161 if (typeof str !== "string") {
-1 36162 return "";
-1 36163 }
-1 36164 return str.replace(/^\s+|\s+$/g, "");
-1 36165 };
-1 36166
34953 36167 // Customize returned string for testable statements
34954 36168
34955 36169 nameSpace.getAccNameMsg = nameSpace.getNames = function(node, overrides) {
@@ -34983,7 +36197,7 @@ Plus roles extended for the Role Parity project.
34983 36197 }
34984 36198 })();
34985 36199
34986 -1 },{}],15:[function(require,module,exports){
-1 36200 },{}],23:[function(require,module,exports){
34987 36201 (function (global){
34988 36202 global.goog = {
34989 36203 provide: function() {},
@@ -35008,11 +36222,12 @@ require('accessibility-developer-tools/src/js/Properties');
35008 36222 module.exports = global.axs;
35009 36223
35010 36224 }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
35011 -1 },{"accessibility-developer-tools/src/js/AccessibilityUtils":1,"accessibility-developer-tools/src/js/BrowserUtils":2,"accessibility-developer-tools/src/js/Color":3,"accessibility-developer-tools/src/js/Constants":4,"accessibility-developer-tools/src/js/DOMUtils":5,"accessibility-developer-tools/src/js/Properties":6}],16:[function(require,module,exports){
-1 36225 },{"accessibility-developer-tools/src/js/AccessibilityUtils":1,"accessibility-developer-tools/src/js/BrowserUtils":2,"accessibility-developer-tools/src/js/Color":3,"accessibility-developer-tools/src/js/Constants":4,"accessibility-developer-tools/src/js/DOMUtils":5,"accessibility-developer-tools/src/js/Properties":6}],24:[function(require,module,exports){
35012 36226 var ariaApi = require('aria-api');
35013 36227 var accdc = require('w3c-alternative-text-computation');
35014 36228 var axe = require('axe-core');
35015 36229 var axs = require('./axs');
-1 36230 var domAccessibilityApi = require('dom-accessibility-api');
35016 36231
35017 36232 var form = document.querySelector('#ba-form');
35018 36233 var preview = document.querySelector('#ba-preview');
@@ -35026,16 +36241,34 @@ var ex = function(fn, args, _this) {
35026 36241 }
35027 36242 };
35028 36243
35029 -1 var implementations = {
35030 -1 'aria-api (0.4.0)': function(el) {
-1 36244 var implementations = [{
-1 36245 name: 'aria-api (0.4.0)',
-1 36246 url: 'https://github.com/xi/aria-api',
-1 36247 fn: function(el) {
35031 36248 return {
35032 36249 name: ex(ariaApi.getName, [el]),
35033 36250 desc: ex(ariaApi.getDescription, [el]),
35034 36251 role: ex(ariaApi.getRole, [el]),
35035 36252 };
35036 36253 },
35037 -1 'accdc (2.49)': accdc.calcNames,
35038 -1 'axe (4.0.2)': function(el) {
-1 36254 }, {
-1 36255 name: 'accdc (2.50)',
-1 36256 url: 'https://github.com/accdc/w3c-alternative-text-computation',
-1 36257 fn: accdc.calcNames,
-1 36258 }, {
-1 36259 name: 'dom-accessibility-api (0.5.4)',
-1 36260 url: 'https://github.com/testing-library/dom-testing-library',
-1 36261 fn: function(el) {
-1 36262 return {
-1 36263 name: domAccessibilityApi.computeAccessibleName(el),
-1 36264 desc: domAccessibilityApi.computeAccessibleDescription(el),
-1 36265 role: domAccessibilityApi.getRole(el),
-1 36266 };
-1 36267 },
-1 36268 }, {
-1 36269 name: 'axe (4.0.2)',
-1 36270 url: 'https://github.com/dequelabs/axe-core',
-1 36271 fn: function(el) {
35039 36272 axe._tree = axe.utils.getFlattenedTree(document.body);
35040 36273 return {
35041 36274 name: ex(axe.commons.text.accessibleText, [el]),
@@ -35043,7 +36276,10 @@ var implementations = {
35043 36276 role: ex(axe.commons.aria.getRole, [el]),
35044 36277 };
35045 36278 },
35046 -1 'axs (2.12.0)': function(el) {
-1 36279 }, {
-1 36280 name: 'axs (2.12.0)',
-1 36281 url: 'https://github.com/GoogleChrome/accessibility-developer-tools',
-1 36282 fn: function(el) {
35047 36283 return {
35048 36284 name: ex(axs.properties.findTextAlternatives, [el, {}]),
35049 36285 desc: '-',
@@ -35052,14 +36288,21 @@ var implementations = {
35052 36288 if (roles) {
35053 36289 return roles.roles.map(x => x.name).join(' ');
35054 36290 }
35055 -1 })
-1 36291 }),
35056 36292 };
35057 36293 },
35058 -1 };
-1 36294 }];
35059 36295
35060 -1 var createTd = function(text) {
-1 36296 var createTd = function(text, url) {
35061 36297 var td = document.createElement('td');
35062 -1 td.textContent = text;
-1 36298 if (url) {
-1 36299 var a = document.createElement('a');
-1 36300 a.href = url;
-1 36301 a.textContent = text;
-1 36302 td.append(a);
-1 36303 } else {
-1 36304 td.textContent = text;
-1 36305 }
35063 36306 return td;
35064 36307 };
35065 36308
@@ -35067,13 +36310,13 @@ var run = function(html) {
35067 36310 preview.innerHTML = html;
35068 36311 results.innerHTML = '';
35069 36312
35070 -1 return Promise.all(Object.keys(implementations).map(function(key) {
35071 -1 var p = implementations[key](preview.querySelector('#test') || preview.children[0] || preview);
-1 36313 return Promise.all(implementations.map(function(impl) {
-1 36314 var p = impl.fn(preview.querySelector('#test') || preview.children[0] || preview);
35072 36315
35073 36316 return Promise.resolve(p).then(function(result) {
35074 36317 var tr = document.createElement('tr');
35075 36318
35076 -1 tr.appendChild(createTd(key));
-1 36319 tr.appendChild(createTd(impl.name, impl.url));
35077 36320 tr.appendChild(createTd(result.name));
35078 36321 tr.appendChild(createTd(result.desc));
35079 36322 tr.appendChild(createTd(result.role));
@@ -35107,4 +36350,4 @@ try {
35107 36350 });
35108 36351 }
35109 36352
35110 -1 },{"./axs":15,"aria-api":7,"axe-core":13,"w3c-alternative-text-computation":14}]},{},[16]);
-1 36353 },{"./axs":23,"aria-api":7,"axe-core":13,"dom-accessibility-api":18,"w3c-alternative-text-computation":22}]},{},[24]);