-
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
Preemptively error when required ES5 shim/shams are not available #1516
Conversation
👍 |
I was going to say you might check |
Seems legit, gonna pull this in |
|
||
for (var i in expectedFeatures) { | ||
if (!expectedFeatures[i]) { | ||
console.error( |
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.
just sanity check: console.error()
is available everywhere console
is available, right?
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.
95% sure yes.
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.
@petehunt Yes it is, even IE8 has it. While it is possible that some browser does not have it, it will still produce an appropriate error message (console.error not available) and we explicitly mention it next to the shims that the console.*
-shim might be necessary. I could do (console.error || console.log)
I guess to be on the really safe side, if you prefer (and add appropriate console.*
methods to the list).
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.
@petehunt PS, you probably want to fb.me
that link.
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'll update this to http://fb.me/react-warning-polyfills
Preemptively error when required ES5 shim/shams are not available
As per @andreypopp's idea in #1507, here's an implementation.
I searched through the React code and discovered the list of required shim/shams in the docs is not up-to-date and have updated this PR accordingly (not the docs).
IE8 and really old (but still circulating) versions of most modern browsers are the troublemakers. So basically pretty much every browsers you'll run into has full support, except for a handful of visitors who lack most of them. http://kangax.github.io/compat-table/es5/
In order to keep an ecosystem of reusable components from second-guessing support (and us having to keep forgetting to update the list of required shims), I would recommend extending the list of required shims to include all ES5 shims (not shams): https://github.com/es-shims/es5-shim, it's not that many more and most are really useful.
__DEV__
only so didn't bother with size comparison.