fix: HTML table fails to import with empty cells

This commit is contained in:
Tom Moor
2024-02-17 22:44:18 -05:00
parent 71d41378db
commit 4e7ea0b7f1
4 changed files with 20 additions and 30 deletions

View File

@@ -0,0 +1,13 @@
export function inHtmlContext(node: HTMLElement, selector: string) {
let currentNode = node;
// start at the closest element
while (currentNode !== null && currentNode.nodeType !== 1) {
currentNode = (currentNode.parentElement ||
currentNode.parentNode) as HTMLElement;
}
return (
currentNode !== null &&
currentNode.nodeType === 1 &&
currentNode.closest(selector) !== null
);
}