required-owned.js 538 B

123456789101112131415161718192021
  1. import standards from '../../standards';
  2. /**
  3. * Get the required owned (children) roles for a given role
  4. * @method requiredOwned
  5. * @memberof axe.commons.aria
  6. * @instance
  7. * @param {String} role The role to check
  8. * @return {Mixed} Either an Array of required owned elements or `null` if there are none
  9. */
  10. function requiredOwned(role) {
  11. const roleDef = standards.ariaRoles[role];
  12. if (!roleDef || !Array.isArray(roleDef.requiredOwned)) {
  13. return null;
  14. }
  15. return [...roleDef.requiredOwned];
  16. }
  17. export default requiredOwned;