lib/checks/navigation/region.js
function findRegionlessElms(virtualNode) {
	const node = virtualNode.actualNode;
	// End recursion if the element is a landmark, skiplink, or hidden content
	if (
		isRegion(virtualNode) ||
		(dom.isSkipLink(virtualNode.actualNode) &&
			dom.getElementByReference(virtualNode.actualNode, 'href')) ||
		!dom.isVisible(node, true)
	) {
		return [];

		// Return the node is a content element
	} else if (dom.hasContent(node, /* noRecursion: */ true)) {
		return [node];

		// Recursively look at all child elements
	} else {
		return virtualNode.children
			.filter(({ actualNode }) => actualNode.nodeType === 1)
			.map(findRegionlessElms)
			.reduce((a, b) => a.concat(b), []); // flatten the results
	}
}
function findRegionlessElms(virtualNode) {
	const node = virtualNode.actualNode;
	// End recursion if the element is a landmark, skiplink, or hidden content
	if (
		isRegion(virtualNode) ||
		(dom.isSkipLink(virtualNode.actualNode) &&
			dom.getElementByReference(virtualNode.actualNode, 'href')) ||
		!dom.isVisible(node, true)
	) {
		return [];

		// Return the node is a content element
	} else if (dom.hasContent(node, /* noRecursion: */ true)) {
		return [node];

		// Recursively look at all child elements
	} else {
		return virtualNode.children
			.filter(({ actualNode }) => actualNode.nodeType === 1)
			.map(findRegionlessElms)
			.reduce((a, b) => a.concat(b), []); // flatten the results
	}
}
function findRegionlessElms ( virtualNode ) { const node = virtualNode . actualNode ; // End recursion if the element is a landmark, skiplink, or hidden content if ( isRegion ( virtualNode ) || ( dom . isSkipLink ( virtualNode . actualNode ) && dom . getElementByReference ( virtualNode . actualNode , 'href' ) ) || ! dom . isVisible ( node , true ) ) { return [ ] ; // Return the node is a content element } else if ( dom . hasContent ( node , /* noRecursion: */ true ) ) { return [ node ] ; // Recursively look at all child elements } else { return virtualNode . children . filter ( ( { actualNode } ) => actualNode . nodeType === 1 ) . map ( findRegionlessElms ) . reduce ( ( a , b ) => a . concat ( b ) , [ ] ) ; // flatten the results } }
Find all visible elements not wrapped inside a landmark or skiplink
Find all visible elements not wrapped inside a landmark or skiplink