UNPKG

web-collect-events-narayana

Version:

An sdk for collecting events from web pages

17 lines (13 loc) 378 B
function isNodeValid(node: HTMLElement): boolean { const validTags = ["BUTTON", "INPUT", "A", "LINK"]; let targetNode = node; for (let i = 0; i < 4; i++) { console.log(targetNode.tagName); if (validTags.includes(targetNode.tagName)) { return true; } targetNode = targetNode.parentNode as HTMLElement; } return false; } export { isNodeValid };