remove plain object warning (#7724)
Stephen John Sorensen committed
Sep 13, 2016 at 22:15 UTC
b2297ae6c3117ca9b3e15aedaf73d9187eb88e6c
3 files changed
-44
src/isomorphic/classic/element/ReactElement.js
-20
@@ -192,16 +192,6 @@ ReactElement.createElement = function(type, config, children) {
192
var source = null;
193
194
if (config != null) {
195
- if (__DEV__) {
196
- warning(
197
- /* eslint-disable no-proto */
198
- config.__proto__ == null || config.__proto__ === Object.prototype,
199
- /* eslint-enable no-proto */
200
- 'React.createElement(...): Expected props argument to be a plain object. ' +
201
- 'Properties defined in its prototype chain will be ignored.'
202
- );
203
- }
204
-
195
if (hasValidRef(config)) {
196
ref = config.ref;
197
}
@@ -327,16 +317,6 @@ ReactElement.cloneElement = function(element, config, children) {
317
var owner = element._owner;
318
319
if (config != null) {
330
- if (__DEV__) {
331
- warning(
332
- /* eslint-disable no-proto */
333
- config.__proto__ == null || config.__proto__ === Object.prototype,
334
- /* eslint-enable no-proto */
335
- 'React.cloneElement(...): Expected props argument to be a plain object. ' +
336
- 'Properties defined in its prototype chain will be ignored.'
337
- );
338
- }
339
-
320
if (hasValidRef(config)) {
321
// Silently steal the ref from the parent.
322
ref = config.ref;
src/isomorphic/classic/element/__tests__/ReactElement-test.js
-12
@@ -188,18 +188,6 @@ describe('ReactElement', () => {
188
expect(element.props.foo).toBe(1);
189
});
190
191
- it('warns if the config object inherits from any type other than Object', () => {
192
- spyOn(console, 'error');
193
- React.createElement('div', {foo: 1});
194
- expect(console.error).not.toHaveBeenCalled();
195
- React.createElement('div', Object.create({foo: 1}));
196
- expect(console.error.calls.count()).toBe(1);
197
- expect(console.error.calls.argsFor(0)[0]).toContain(
198
- 'React.createElement(...): Expected props argument to be a plain object. ' +
199
- 'Properties defined in its prototype chain will be ignored.'
200
- );
201
- });
202
-
191
it('extracts key and ref from the config', () => {
192
var element = React.createFactory(ComponentClass)({
193
key: '12',
src/isomorphic/classic/element/__tests__/ReactElementClone-test.js
-12
@@ -75,18 +75,6 @@ describe('ReactElementClone', () => {
75
expect(ReactDOM.findDOMNode(component).childNodes[0].className).toBe('xyz');
76
});
77
78
- it('should warn if the config object inherits from any type other than Object', () => {
79
- spyOn(console, 'error');
80
- React.cloneElement('div', {foo: 1});
81
- expect(console.error).not.toHaveBeenCalled();
82
- React.cloneElement('div', Object.create({foo: 1}));
83
- expect(console.error.calls.count()).toBe(1);
84
- expect(console.error.calls.argsFor(0)[0]).toContain(
85
- 'React.cloneElement(...): Expected props argument to be a plain object. ' +
86
- 'Properties defined in its prototype chain will be ignored.'
87
- );
88
- });
89
-
78
it('does not fail if config has no prototype', () => {
79
var config = Object.create(null, {foo: {value: 1, enumerable: true}});
80
React.cloneElement(<div />, config);