Type guard that checks whether an EventTarget is a DOM Element.
Uses nodeType === 1 (ELEMENT_NODE) rather than instanceof Element
so that it works correctly across different realms (e.g. iframes) and
in testing environments like happy-dom where the Element constructor
may differ from the one in the main window.
Parameters
target: EventTarget|null
The event target to check, typically from event.target.
Type guard that checks whether an
EventTargetis a DOMElement.Uses
nodeType === 1(ELEMENT_NODE) rather thaninstanceof Elementso that it works correctly across different realms (e.g. iframes) and in testing environments like happy-dom where theElementconstructor may differ from the one in the main window.