feat: filter null/undefined vals from potential selector nodes
This commit is contained in:
@@ -399,9 +399,16 @@ export const getSelectors = async (page: Page, coordinates: Coordinates) => {
|
|||||||
return node.name !== 'html' && !node.name.startsWith('#');
|
return node.name !== 'html' && !node.name.startsWith('#');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function maybe(...level: (Node | null)[]): Node[] | null {
|
||||||
|
const list = level.filter(notEmpty);
|
||||||
|
if (list.length > 0) {
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user