-
Notifications
You must be signed in to change notification settings - Fork 46.9k
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
chore(syntheticEvent): remove IE8 code #11178
Conversation
Since IE8 has been deprecated for a while, I thought it might be useful to remove some IE8-only code If this is not something you want to focus on yet, or is too much work to test, feel free to close this PR
} else { | ||
return window; | ||
} | ||
return doc.defaultView; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should return target.ownerDocument.parentWindow
immediately.
We’ll need someone to verify this is only the case in IE8, and not IE9+. |
If I read MDN correctly, it's added in IE9, but should definitely be tested thoroughly |
MDN says MSDN also doesn’t mention any version support differences: https://msdn.microsoft.com/library/ms534315(v=vs.85).aspx So there’s clearly something else happening here. |
} else { | ||
return window; | ||
} | ||
return target.ownerDocument.defaultView; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe you could still have cases where ownerDocument is undefined, e.g. if the node is detached (for some reason)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep! UIEvent.view
is supported in:
IE9-11
Safari Desktop 4, 5.1, 6.2, 7.1, 10.1, 11.0
Safari iOS 3, 4
FF 47
Windows Phone 8.1
Here's my test case:
https://codepen.io/nhunzaker/pen/BwVwqo
And I've submitted a revision to this page on MDN:
https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/view
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to my research (https://github.com/facebook/react/pull/11178/files#r143985409), we can totally remove the event.view
polyfill.
Could you remove the event.view entry?
I did some testing of
So basically everywhere except below IE9. IE 11/Windows Phone always reports 0 for detail, but we don't attempt to fix this in React. We should remove the patch for event.detail |
@nhunzaker, so I can remove all the code after |
} else { | ||
return window; | ||
} | ||
return event.view; | ||
}, | ||
detail: function(event) { | ||
return event.detail || 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe, unless I'm mistaken, this can be:
var UIEventInterface = {
view: null,
detail: null
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe the var can be completely removed then? and not augmenting the class?
everything breaks otherwise
I did the augment with twice |
Why should not removing it completely ? |
@blling synthetic events maintain an interface so that they can copy over properties. It does that here: The keys can't be completely removed because they tell |
Get it, thanks! |
Thanks, @Haroenv! |
Thanks for your guidance @nhunzaker |
Since IE8 has been deprecated for a while, I thought it might be useful to remove some IE8-only code
If this is not something you want to focus on yet, or is too much work to test, feel free to close this PR
Before submitting a pull request, please make sure the following is done:
master
.npm test
).npm run prettier
).npm run lint
).npm run flow
).