Skip to content

Commit f95747b

Browse files
committed
Remove dependence on ES5 shams per facebook#4189
Docs not updated
1 parent 870a15a commit f95747b

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

src/isomorphic/classic/element/ReactElement.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,10 @@ var ReactElement = function(type, key, ref, self, source, owner, props) {
109109
element._self = self;
110110
element._source = source;
111111
}
112-
Object.freeze(element.props);
113-
Object.freeze(element);
112+
if (Object.freeze) {
113+
Object.freeze(element.props);
114+
Object.freeze(element);
115+
}
114116
}
115117

116118
return element;

src/renderers/dom/ReactDOM.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,16 +98,12 @@ if (__DEV__) {
9898
Object.keys,
9999
String.prototype.split,
100100
String.prototype.trim,
101-
102-
// shams
103-
Object.create,
104-
Object.freeze,
105101
];
106102

107103
for (var i = 0; i < expectedFeatures.length; i++) {
108104
if (!expectedFeatures[i]) {
109105
console.error(
110-
'One or more ES5 shim/shams expected by React are not available: ' +
106+
'One or more ES5 shims expected by React are not available: ' +
111107
'https://fb.me/react-warning-polyfills'
112108
);
113109
break;

src/renderers/dom/client/syntheticEvents/SyntheticEvent.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,10 @@ SyntheticEvent.Interface = EventInterface;
175175
SyntheticEvent.augmentClass = function(Class, Interface) {
176176
var Super = this;
177177

178-
var prototype = Object.create(Super.prototype);
178+
var E = function () {};
179+
E.prototype = Super.prototype;
180+
var prototype = new E();
181+
179182
assign(prototype, Class.prototype);
180183
Class.prototype = prototype;
181184
Class.prototype.constructor = Class;

0 commit comments

Comments
 (0)