/**
 * Get the text value of aria-label, if any
 *
 * @deprecated Do not use Element directly. Pass VirtualNode instead
 * @param {VirtualNode|Element} element
 * @return {string} ARIA label
 */
function arialabelText(node) {
	// TODO: this is a ridiculous hack since webpack is making these two
	// separate functions
	// TODO: es-module-AbstractVirtualNode
	if (!axe._isAbstractNode(node)) {
		if (node.nodeType !== 1) {
			return '';
		}
		// TODO: es-module-utils.getNodeFromTree
		node = axe.utils.getNodeFromTree(node);
	}
	return node.attr('aria-label') || '';
}

export default arialabelText;

import AbstractVirtualNode from '../../core/base/virtual-node/abstract-virtual-node';
import { getNodeFromTree } from '../../core/utils';

/**
 * Get the text value of aria-label, if any
 *
 * @deprecated Do not use Element directly. Pass VirtualNode instead
 * @param {VirtualNode|Element} element
 * @return {string} ARIA label
 */
function arialabelText(vNode) {
	if (!(vNode instanceof AbstractVirtualNode)) {
		if (vNode.nodeType !== 1) {
			return '';
		}
		vNode = getNodeFromTree(vNode);
	}
	return vNode.attr('aria-label') || '';
}

export default arialabelText;

refactor arialabel-text (#2342)