luhn-generator
Version:
A generator of numbers that passes the validation of Luhn algorithm or Luhn formula, also known as the 'modulus 10' or 'mod 10' algorithm
27 lines (21 loc) • 785 B
JavaScript
import { querySelectorAll } from '../../core/utils';
/**
* Get all elements (including given node) that are part of the tab order
* @method getTabbableElements
* @memberof axe.commons.dom
* @instance
* @param {Object} virtualNode The virtualNode to assess
* @return {Boolean}
*/
function getTabbableElements(virtualNode) {
const nodeAndDescendents = querySelectorAll(virtualNode, '*');
const tabbableElements = nodeAndDescendents.filter(vNode => {
const isFocusable = vNode.isFocusable;
let tabIndex = vNode.actualNode.getAttribute('tabindex');
tabIndex =
tabIndex && !isNaN(parseInt(tabIndex, 10)) ? parseInt(tabIndex) : null;
return tabIndex ? isFocusable && tabIndex >= 0 : isFocusable;
});
return tabbableElements;
}
export default getTabbableElements;