This commit is contained in:
eewing
2026-02-17 14:10:16 -06:00
parent 2bca5834c5
commit cf73cd3b4c
11246 changed files with 1690552 additions and 0 deletions
+20
View File
@@ -0,0 +1,20 @@
export function getFirstNonCommentChild(element) {
if (!element)
return null;
for (const child of element.childNodes) {
if (child.nodeType !== Node.COMMENT_NODE) {
return child;
}
}
return null;
}
/**
* Determines if the click event truly occurred outside the content node.
* This was added to handle password managers and other elements that may be injected
* into the DOM but visually appear inside the content.
*/
export function isClickTrulyOutside(event, contentNode) {
const { clientX, clientY } = event;
const rect = contentNode.getBoundingClientRect();
return (clientX < rect.left || clientX > rect.right || clientY < rect.top || clientY > rect.bottom);
}