Skip to content

Commit

Permalink
Merge pull request #1516 from syranide/es5err
Browse files Browse the repository at this point in the history
Preemptively error when required ES5 shim/shams are not available
  • Loading branch information
petehunt committed May 12, 2014
2 parents d46e158 + 659b798 commit e4f80f3
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/browser/ui/React.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,34 @@ if (__DEV__) {
'Download the React DevTools for a better development experience: ' +
'http://fb.me/react-devtools'
);

var expectedFeatures = [
// shims
Array.isArray,
Array.prototype.every,
Array.prototype.forEach,
Array.prototype.indexOf,
Array.prototype.map,
Date.now,
Function.prototype.bind,
Object.keys,
String.prototype.split,

// shams
Object.create,
Object.freeze
];

for (var i in expectedFeatures) {
if (!expectedFeatures[i]) {
console.error(
'One or more ES5 shim/shams expected by React are not available: ' +
'http://facebook.github.io/react/docs/working-with-the-browser.html' +
'#polyfills-needed-to-support-older-browsers'
);
break;
}
}
}
}

Expand Down

0 comments on commit e4f80f3

Please sign in to comment.