accessible-text.js 660 B

12345678910111213141516171819
  1. import accessibleTextVirtual from './accessible-text-virtual';
  2. import { getNodeFromTree } from '../../core/utils';
  3. /**
  4. * Finds virtual node and calls accessibleTextVirtual()
  5. * IMPORTANT: This method requires the composed tree at axe._tree
  6. *
  7. * @param {HTMLElement} element The HTMLElement
  8. * @param {Object} context
  9. * @property {Bool} inControlContext
  10. * @property {Bool} inLabelledByContext
  11. * @return {string}
  12. */
  13. function accessibleText(element, context) {
  14. const virtualNode = getNodeFromTree(element); // throws an exception on purpose if axe._tree not correct
  15. return accessibleTextVirtual(virtualNode, context);
  16. }
  17. export default accessibleText;