lib/checks/navigation/region.js
function isRegion(virtualNode) {
	const node = virtualNode.actualNode;
	const explicitRole = axe.commons.aria.getRole(node, { noImplicit: true });
	const ariaLive = (node.getAttribute('aria-live') || '').toLowerCase().trim();

	if (explicitRole) {
		return explicitRole === 'dialog' || landmarkRoles.includes(explicitRole);
	}
	// Ignore content inside of aria-live
	if (['assertive', 'polite'].includes(ariaLive)) {
		return true;
	}

	// Check if the node matches any of the CSS selectors of implicit landmarks
	return implicitLandmarks.some(implicitSelector => {
		let matches = axe.utils.matchesSelector(node, implicitSelector);
		if (node.nodeName.toUpperCase() === 'FORM') {
			let titleAttr = node.getAttribute('title');
			let title =
				titleAttr && titleAttr.trim() !== ''
					? axe.commons.text.sanitize(titleAttr)
					: null;
			return matches && (!!aria.labelVirtual(virtualNode) || !!title);
		}
		return matches;
	});
}
function isRegion(virtualNode) {
	const node = virtualNode.actualNode;
	const explicitRole = axe.commons.aria.getRole(node, { noImplicit: true });
	const ariaLive = (node.getAttribute('aria-live') || '').toLowerCase().trim();

	if (explicitRole) {
		return explicitRole === 'dialog' || landmarkRoles.includes(explicitRole);
	}
	// Ignore content inside of aria-live
	if (['assertive', 'polite'].includes(ariaLive)) {
		return true;
	}

	// Check if the node matches any of the CSS selectors of implicit landmarks
	return implicitLandmarks.some(implicitSelector => {
		let matches = axe.utils.matchesSelector(node, implicitSelector);
		if (node.nodeName.toUpperCase() === 'FORM') {
			let titleAttr = node.getAttribute('title');
			let title =
				titleAttr && titleAttr.trim() !== ''
					? axe.commons.text.sanitize(titleAttr)
					: null;
			return matches && (!!aria.labelVirtual(virtualNode) || !!title);
		}
		return matches;
	});
}
function isRegion ( virtualNode ) { const node = virtualNode . actualNode ; const explicitRole = axe . commons . aria . getRole ( node , { noImplicit : true } ) ; const ariaLive = ( node . getAttribute ( 'aria-live' ) || '' ) . toLowerCase ( ) . trim ( ) ; if ( explicitRole ) { return explicitRole === 'dialog' || landmarkRoles . includes ( explicitRole ) ; } // Ignore content inside of aria-live if ( [ 'assertive' , 'polite' ] . includes ( ariaLive ) ) { return true ; } // Check if the node matches any of the CSS selectors of implicit landmarks return implicitLandmarks . some ( implicitSelector => { let matches = axe . utils . matchesSelector ( node , implicitSelector ) ; if ( node . nodeName . toUpperCase ( ) === 'FORM' ) { let titleAttr = node . getAttribute ( 'title' ) ; let title = titleAttr && titleAttr . trim ( ) !== '' ? axe . commons . text . sanitize ( titleAttr ) : null ; return matches && ( ! ! aria . labelVirtual ( virtualNode ) || ! ! title ) ; } return matches ; } ) ; }
Check if the current element is a landmark
Check if the current element is a landmark