UNPKG

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 (22 loc) 696 B
import { implicitRole } from '../../commons/aria'; import { getAriaRolesByType } from '../../commons/standards'; import { getComposedParent } from '../../commons/dom'; function landmarkIsTopLevelEvaluate(node) { var landmarks = getAriaRolesByType('landmark'); var parent = getComposedParent(node); this.data({ role: node.getAttribute('role') || implicitRole(node) }); while (parent) { var role = parent.getAttribute('role'); if (!role && parent.nodeName.toUpperCase() !== 'FORM') { role = implicitRole(parent); } if (role && landmarks.includes(role)) { return false; } parent = getComposedParent(parent); } return true; } export default landmarkIsTopLevelEvaluate;