lib/core/utils/preload-cssom.js
function getAllRootNodesInTree(tree) {
	let ids = [];

	const rootNodes = axe.utils
		.querySelectorAllFilter(tree, '*', node => {
			if (ids.includes(node.shadowId)) {
				return false;
			}
			ids.push(node.shadowId);
			return true;
		})
		.map(node => {
			return {
				shadowId: node.shadowId,
				rootNode: axe.utils.getRootNode(node.actualNode)
			};
		});

	return axe.utils.uniqueArray(rootNodes, []);
}
function getAllRootNodesInTree(tree) {
	let ids = [];

	const rootNodes = axe.utils
		.querySelectorAllFilter(tree, '*', node => {
			if (ids.includes(node.shadowId)) {
				return false;
			}
			ids.push(node.shadowId);
			return true;
		})
		.map(node => {
			return {
				shadowId: node.shadowId,
				rootNode: axe.utils.getRootNode(node.actualNode)
			};
		});

	return axe.utils.uniqueArray(rootNodes, []);
}
function getAllRootNodesInTree ( tree ) { let ids = [ ] ; const rootNodes = axe . utils . querySelectorAllFilter ( tree , '*' , node => { if ( ids . includes ( node . shadowId ) ) { return false ; } ids . push ( node . shadowId ) ; return true ; } ) . map ( node => { return { shadowId : node . shadowId , rootNode : axe . utils . getRootNode ( node . actualNode ) } ; } ) ; return axe . utils . uniqueArray ( rootNodes , [ ] ) ; }
Returns am array of source nodes containing `document` and `documentFragment` in a given `tree`.

@param {Object} treeRoot tree
@returns {Array<Object>} array of objects, which each object containing a root and an optional `shadowId`
Returns am array of source nodes containing document and documentFragment in a given tree .