1

Chrome version 66.0.3359.117

is bug or new rule ? (not 65 version)

if executed under javascript

window['event'] = undefined;

after .. any event raise..

always window['event'] object is undefined

<button onclick="console.log(window['event'])" >button1</button>
<button onclick="window['event'] = undefined;" >button2</button>

button1 click display console event object, button2 click after button1 click display console undefined..

but, ie11, edge, chrome 65(maybe..) is button2 click after button1 click display console event object

T.J. Crowder
  • 1,031,962
  • 187
  • 1,923
  • 1,875
  • 1
    Maybe have a look at https://stackoverflow.com/questions/29423624/javascript-events-window-event-vs-argument-reference-function window.event isnt a standard property – Mario Murrent Apr 26 '18 at 12:54
  • I can confirm the behavior did change between Chrome 65 and Chrome 66. Chrome 65 didn't let you set `window.event` to `undefined`. Chrome 66 does. Why in heaven's name would you do something like that, though?? :-) Oh, wait, I can think of a reason: So you don't accidentally use it by forgetting to declare the `event` parameter in a handler... Probably better just to ensure you do thorough testing in Firefox, which doesn't have it in the first place. – T.J. Crowder Apr 26 '18 at 12:57
  • 1
    Why is that the dupe? Guessing someone did not really read the question. – epascarello Apr 26 '18 at 12:59
  • 1
    In addition, if the value of "window.event" is specified arbitrarily, any event does not change the last value inserted. However, previous versions of Chrome, or other browsers I have tested, change to the last event object when an event occurs. Also, in "Chrome 66", if you do not put any value in "window.event", it will be changed to the last event object whenever an event occurs. – Hyunwoo Hwang Apr 26 '18 at 13:54
  • @HyunwooHwang: *"... if you do not put any value in "window.event", it will be changed to the last event object whenever an event occurs."* Yes, that's the Microsoft-specific behavior that Chrome emulates for compatibility (and which Firefox doesn't). – T.J. Crowder Apr 26 '18 at 14:08
  • I'm really curious why you're assigning to `window.event`. Is it for the reason I suggest above, or...? – T.J. Crowder Apr 26 '18 at 14:13

0 Answers0