feat: check if id valid as per idName

This commit is contained in:
karishmas6
2024-06-05 23:19:40 +05:30
parent fe39d8620f
commit 66ad8e9c28

View File

@@ -305,7 +305,12 @@ export const getSelectors = async (page: Page, coordinates: Coordinates) => {
function id(input: Element): Node | null {
const elementId = input.getAttribute('id');
if (elementId && config.idName(elementId)) {
return {
name: '#' + cssesc(elementId, { isIdentifier: true }),
penalty: 0,
};
}
return null;
}