11 lines
244 B
JavaScript
11 lines
244 B
JavaScript
export default function isEventWithinNode(event, node) {
|
|
if (!event || !node) {
|
|
return false
|
|
}
|
|
|
|
if (typeof event.composedPath === 'function') {
|
|
return event.composedPath().includes(node)
|
|
}
|
|
|
|
return node.contains(event.target)
|
|
} |