has-content.js 784 B

123456789101112131415161718192021
  1. import hasContentVirtual from './has-content-virtual';
  2. import { getNodeFromTree } from '../../core/utils';
  3. /**
  4. * Find virtual node and call hasContentVirtual()
  5. * IMPORTANT: This method requires the composed tree at axe._tree
  6. * @see axe.commons.dom.hasContentVirtual
  7. * @method hasContent
  8. * @memberof axe.commons.dom
  9. * @instance
  10. * @param {DOMNode} elm DOMNode element to check
  11. * @param {Boolean} noRecursion If true, only the element is checked, otherwise it will search all child nodes
  12. * @param {Boolean} ignoreAria if true, ignores `aria label` computation for content deduction
  13. * @return {Boolean}
  14. */
  15. function hasContent(elm, noRecursion, ignoreAria) {
  16. elm = getNodeFromTree(elm);
  17. return hasContentVirtual(elm, noRecursion, ignoreAria);
  18. }
  19. export default hasContent;