- commit
- 1200041f701e3c4d79001fff95ea9289d5e0e433
- parent
- 2446de1005281698d40848f7eeb6f15aeae42fbe
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2018-02-20 22:34
update accdc
Diffstat
| M | babel.js | 137 | ++++++++++++++++++++++++++++++++++--------------------------- |
1 files changed, 76 insertions, 61 deletions
diff --git a/babel.js b/babel.js
@@ -14207,12 +14207,12 @@ module.exports = {
14207 14207 })(typeof window === 'object' ? window : this);
14208 14208 },{}],13:[function(require,module,exports){
14209 14209 /*!
14210 -1 CalcNames 1.4, compute the Name and Description property values for a DOM node
-1 14210 CalcNames 1.8, compute the Name and Description property values for a DOM node
14211 14211 Returns an object with 'name' and 'desc' properties.
14212 14212 Functionality mirrors the steps within the W3C Accessible Name and Description computation algorithm.
14213 14213 http://www.w3.org/TR/accname-aam-1.1/
14214 14214 Authored by Bryan Garaventa plus refactoring contrabutions by Tobias Bengfort
14215 -1 https://github.com/accdc/w3c-alternative-text-computation
-1 14215 https://github.com/whatsock/w3c-alternative-text-computation
14216 14216 Distributed under the terms of the Open Source Initiative OSI - MIT License
14217 14217 */
14218 14218
@@ -14225,7 +14225,7 @@ var calcNames = function(node, fnc, preventVisualARIASelfCSSRef) {
14225 14225 var nodes = [];
14226 14226
14227 14227 // Recursively process a DOM node to compute an accessible name in accordance with the spec
14228 -1 var walk = function(refNode, stop, skip, nodesToIgnoreValues) {
-1 14228 var walk = function(refNode, stop, skip, nodesToIgnoreValues, skipAbort) {
14229 14229 var fullName = '';
14230 14230
14231 14231 // Placeholder for storing CSS before and after pseudo element text values for the top level node
@@ -14264,8 +14264,8 @@ var calcNames = function(node, fnc, preventVisualARIASelfCSSRef) {
14264 14264 // Recursively apply the same naming computation to all nodes within the referenced structure
14265 14265 walkDOM(refNode, function(node) {
14266 14266
14267 -1 if (skip || !node || nodes.indexOf(node) !== -1 || (isHidden(node, refNode))) {
14268 -1 // Abort if algorithm step is already completed, or if node is a hidden child of refNode, or if this node has already been processed.
-1 14267 if ((skip || !node || nodes.indexOf(node) !== -1 || (isHidden(node, refNode))) && !skipAbort) {
-1 14268 // 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.
14269 14269 return;
14270 14270 }
14271 14271
@@ -14326,7 +14326,7 @@ var calcNames = function(node, fnc, preventVisualARIASelfCSSRef) {
14326 14326 for (var i = 0; i < ids.length; i++) {
14327 14327 var element = document.getElementById(ids[i]);
14328 14328 // Also prevent the current form field from having its value included in the naming computation if nested as a child of label
14329 -1 parts.push(walk(element, true, skip, [node]));
-1 14329 parts.push(walk(element, true, skip, [node], element === refNode));
14330 14330 }
14331 14331 // Check for blank value, since whitespace chars alone are not valid as a name
14332 14332 name = addSpacing(trim(parts.join(' ')));
@@ -14396,8 +14396,18 @@ var calcNames = function(node, fnc, preventVisualARIASelfCSSRef) {
14396 14396 name = addSpacing(trim(walk(getParent(node, 'label'), true, skip, [node])));
14397 14397 }
14398 14398
14399 -1 // Otherwise, if name is still empty and current node is non-presentational and is a standard img with a non-empty alt attribute, set alt attribute value as the accessible name.
14400 -1 else if (!name && !rolePresentation && nTag == 'img' && node.getAttribute('alt')) {
-1 14399 // Otherwise, if name is still empty and the current node is non-presentational and is a standard form field with a non-empty value property, set name as the property value.
-1 14400 if (!name && !rolePresentation && node === refNode && isNativeFormField && node.value) {
-1 14401 // Check for blank value, since whitespace chars alone are not valid as a name
-1 14402 name = addSpacing(trim(node.value));
-1 14403 }
-1 14404 else if (!name && !rolePresentation && node === refNode && isSimulatedFormField && ['scrollbar', 'slider', 'spinbutton'].indexOf(nRole) !== -1) {
-1 14405 // For range widgets, append aria-valuetext if non-empty, or aria-valuenow if non-empty, or node.value if applicable.
-1 14406 name = getObjectValue(nRole, node, true);
-1 14407 }
-1 14408
-1 14409 // Otherwise, if name is still empty and current node is non-presentational and is a standard img or image button with a non-empty alt attribute, set alt attribute value as the accessible name.
-1 14410 else if (!name && !rolePresentation && (nTag == 'img' || (nTag == 'input' && node.getAttribute('type') == 'image')) && node.getAttribute('alt')) {
14401 14411 // Check for blank value, since whitespace chars alone are not valid as a name
14402 14412 name = addSpacing(trim(node.getAttribute('alt')));
14403 14413 }
@@ -14452,41 +14462,11 @@ var calcNames = function(node, fnc, preventVisualARIASelfCSSRef) {
14452 14462 return fullName;
14453 14463 };
14454 14464
14455 -1 var walkDOM = function(node, fn, refNode) {
14456 -1 if (!node) {
14457 -1 return;
14458 -1 }
14459 -1 fn(node);
14460 -1 if (!isException(node, refNode)) {
14461 -1 node = node.firstChild;
14462 -1 while (node) {
14463 -1 walkDOM(node, fn, refNode);
14464 -1 node = node.nextSibling;
14465 -1 }
14466 -1 }
14467 -1 };
14468 -1
14469 -1 var trim = function(str) {
14470 -1 if (typeof str !== 'string') {
14471 -1 return '';
14472 -1 }
14473 -1 return str.replace(/^\s+|\s+$/g, '');
14474 -1 };
14475 -1
14476 -1 var isFocusable = function(node) {
14477 -1 var nodeName = node.nodeName.toLowerCase();
14478 -1 if (node.getAttribute('tabindex')) {
14479 -1 return true;
14480 -1 }
14481 -1 if (nodeName === 'a' && node.getAttribute('href')) {
14482 -1 return true;
14483 -1 }
14484 -1 if (['input', 'select', 'button'].indexOf(nodeName) !== -1 && node.getAttribute('type') !== 'hidden') {
14485 -1 return true;
14486 -1 }
14487 -1 return false;
14488 -1 };
14489 -1
-1 14465 /*
-1 14466 ARIA Role Exception Rule Set 1.0
-1 14467 The following Role Exception Rule Set is based on the following ARIA Working Group discussion involving all relevant browser venders.
-1 14468 https://lists.w3.org/Archives/Public/public-aria/2017Jun/0057.html
-1 14469 */
14490 14470 var isException = function(node, refNode) {
14491 14471 if (!refNode || !node || refNode.nodeType !== 1 || node.nodeType !== 1) {
14492 14472 return false;
@@ -14532,6 +14512,51 @@ var calcNames = function(node, fnc, preventVisualARIASelfCSSRef) {
14532 14512 }
14533 14513 };
14534 14514
-1 14515 var isFocusable = function(node) {
-1 14516 var nodeName = node.nodeName.toLowerCase();
-1 14517 if (node.getAttribute('tabindex')) {
-1 14518 return true;
-1 14519 }
-1 14520 if (nodeName === 'a' && node.getAttribute('href')) {
-1 14521 return true;
-1 14522 }
-1 14523 if (['input', 'select', 'button'].indexOf(nodeName) !== -1 && node.getAttribute('type') !== 'hidden') {
-1 14524 return true;
-1 14525 }
-1 14526 return false;
-1 14527 };
-1 14528
-1 14529 var isHidden = function(node, refNode) {
-1 14530 if (node.nodeType !== 1 || node == refNode) {
-1 14531 return false;
-1 14532 }
-1 14533
-1 14534 if (node.getAttribute('aria-hidden') === 'true') {
-1 14535 return true;
-1 14536 }
-1 14537
-1 14538 var style = getStyleObject(node);
-1 14539 if (style['display'] === 'none' || style['visibility'] === 'hidden') {
-1 14540 return true;
-1 14541 }
-1 14542
-1 14543 return false;
-1 14544 };
-1 14545
-1 14546 var walkDOM = function(node, fn, refNode) {
-1 14547 if (!node) {
-1 14548 return;
-1 14549 }
-1 14550 fn(node);
-1 14551 if (!isException(node, refNode)) {
-1 14552 node = node.firstChild;
-1 14553 while (node) {
-1 14554 walkDOM(node, fn, refNode);
-1 14555 node = node.nextSibling;
-1 14556 }
-1 14557 }
-1 14558 };
-1 14559
14535 14560 var getStyleObject = function(node) {
14536 14561 var style = {};
14537 14562 if (document.defaultView && document.defaultView.getComputedStyle) {
@@ -14582,23 +14607,6 @@ var calcNames = function(node, fnc, preventVisualARIASelfCSSRef) {
14582 14607 */
14583 14608 var blockElements = ['address', 'article', 'aside', 'blockquote', 'br', 'canvas', 'dd', 'div', 'dl', 'dt', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'header', 'hgroup', 'hr', 'li', 'main', 'nav', 'noscript', 'ol', 'output', 'p', 'pre', 'section', 'table', 'tfoot', 'ul', 'video'];
14584 14609
14585 -1 var isHidden = function(node, refNode) {
14586 -1 if (node.nodeType !== 1 || node == refNode) {
14587 -1 return false;
14588 -1 }
14589 -1
14590 -1 if (node.getAttribute('aria-hidden') === 'true') {
14591 -1 return true;
14592 -1 }
14593 -1
14594 -1 var style = getStyleObject(node);
14595 -1 if (style['display'] === 'none' || style['visibility'] === 'hidden') {
14596 -1 return true;
14597 -1 }
14598 -1
14599 -1 return false;
14600 -1 };
14601 -1
14602 14610 var getObjectValue = function(role, node, isRange, isEdit, isSelect, isNative) {
14603 14611 var val = '';
14604 14612 var bypass = false;
@@ -14715,7 +14723,7 @@ var calcNames = function(node, fnc, preventVisualARIASelfCSSRef) {
14715 14723 var getParent = function(node, nTag) {
14716 14724 while (node) {
14717 14725 node = node.parentNode;
14718 -1 if (node.nodeName.toLowerCase() == nTag) {
-1 14726 if (node && node.nodeName && node.nodeName.toLowerCase() == nTag) {
14719 14727 return node;
14720 14728 }
14721 14729 }
@@ -14741,6 +14749,13 @@ var calcNames = function(node, fnc, preventVisualARIASelfCSSRef) {
14741 14749 return false;
14742 14750 };
14743 14751
-1 14752 var trim = function(str) {
-1 14753 if (typeof str !== 'string') {
-1 14754 return '';
-1 14755 }
-1 14756 return str.replace(/^\s+|\s+$/g, '');
-1 14757 };
-1 14758
14744 14759 if (isHidden(node, document.body) || hasParentLabel(node, true, document.body)) {
14745 14760 return;
14746 14761 }