Can anyone explain the reason for this? Given that window.event is not defined anywhere and after this callback if you check window.event, it comes as undefined. I have checked this on Chrome, Safari and Firefox, the behavior is the same. This is also applicable for onmessage.
document.addEventListener("click", function(e) {
console.log("event clicked: ", e); // PointerEvent
console.log(window.event); // PointerEvent
})
NOTE: Once you set window.event , then it doesn't behave like this.
Reason for this behaviour of the browsers