-
Notifications
You must be signed in to change notification settings - Fork 47.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Global window.event
is overwritten in React 16.5+ in development mode.
#13688
Comments
Want to send a PR to reset it? As long as we handle nesting correctly. |
@gaearon, I've tried a couple of things, and I don't think it's possible to restore the property correctly. Initially {
configurable: true,
enumerable: false,
get: ...,
set: ...
} After it has been assigned (e.g. {
configurable: true,
enumerable: true,
value: undefined,
writable: true
} After undefined I would suggest using something other than |
I'm sorry about this. In testing I observed that changes to window.event made within event handlers are restored at the end of the event handler. That said I can't reproduce this any more, so I must have been mistaken. I am happy with either exposing this somewhere other than
|
@ConradIrwin I've applied the suggested fix for a project where the issue was initially detected -- it works fine for me. I've also verified a restored descriptor: Let me know if you would like to make PR yourself or delegate it. |
I should be able to get to it tomorrow , if you want to jump ahead of me, please feel free :D.
Conrad
Sent via Superhuman ( https://sprh.mn/?vip=conrad.irwin@gmail.com )
…On Wed, Sep 19, 2018 at 2:11 PM, Sergei Startsev < ***@***.*** > wrote:
@ ConradIrwin ( https://github.com/ConradIrwin ) I've applied the suggested
fix for a project where the issue was initially detected -- it works fine
for me.
I've also verified a restored descriptor:
image (
https://user-images.githubusercontent.com/748074/45781393-7fb52a00-bc68-11e8-975e-84d1ea0eaac3.png
)
Let me know if you would like to make PR yourself or delegate it.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub (
#13688 (comment) ) ,
or mute the thread (
https://github.com/notifications/unsubscribe-auth/AAFwQINLCCGDKD468unPO_9vBU3qYlmyks5ucrL9gaJpZM4WwNfH
).
|
@ConradIrwin np, the changes look pretty straightforward 😉 |
Do you want to request a feature or report a bug?
Report a bug.
What is the current behavior?
Global
window.event
is overwritten in React 16.5+ in development mode. Here're minimal repro steps:If you click the button, you see
DOMContentLoaded
event type.What is the expected behavior?
The current behavior contradicts with specified behavior window property event returns the Event which is currently being handled by the site's code. Outside the context of an event handler, the value is always
undefined
. Moreover it works properly in production mode:It returns expected
click
event type.Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?
It works properly in React 16.4.2 and prod mode:
The issue is reproduced in Chrome 69. It works properly in FF 62 (
window.event
isn't support in 62, however it should be reproduced in FF 63 - it was recently added, see details).It seems that the issue was introduced by @ConradIrwin in #11696.
The text was updated successfully, but these errors were encountered: