Skip to content

Commit

Permalink
remove plain object warning (#7724)
Browse files Browse the repository at this point in the history
  • Loading branch information
spudly authored and sophiebits committed Sep 14, 2016
1 parent 9eba808 commit b2297ae
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 44 deletions.
20 changes: 0 additions & 20 deletions src/isomorphic/classic/element/ReactElement.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,16 +192,6 @@ ReactElement.createElement = function(type, config, children) {
var source = null;

if (config != null) {
if (__DEV__) {
warning(
/* eslint-disable no-proto */
config.__proto__ == null || config.__proto__ === Object.prototype,
/* eslint-enable no-proto */
'React.createElement(...): Expected props argument to be a plain object. ' +
'Properties defined in its prototype chain will be ignored.'
);
}

if (hasValidRef(config)) {
ref = config.ref;
}
Expand Down Expand Up @@ -327,16 +317,6 @@ ReactElement.cloneElement = function(element, config, children) {
var owner = element._owner;

if (config != null) {
if (__DEV__) {
warning(
/* eslint-disable no-proto */
config.__proto__ == null || config.__proto__ === Object.prototype,
/* eslint-enable no-proto */
'React.cloneElement(...): Expected props argument to be a plain object. ' +
'Properties defined in its prototype chain will be ignored.'
);
}

if (hasValidRef(config)) {
// Silently steal the ref from the parent.
ref = config.ref;
Expand Down
12 changes: 0 additions & 12 deletions src/isomorphic/classic/element/__tests__/ReactElement-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,18 +188,6 @@ describe('ReactElement', () => {
expect(element.props.foo).toBe(1);
});

it('warns if the config object inherits from any type other than Object', () => {
spyOn(console, 'error');
React.createElement('div', {foo: 1});
expect(console.error).not.toHaveBeenCalled();
React.createElement('div', Object.create({foo: 1}));
expect(console.error.calls.count()).toBe(1);
expect(console.error.calls.argsFor(0)[0]).toContain(
'React.createElement(...): Expected props argument to be a plain object. ' +
'Properties defined in its prototype chain will be ignored.'
);
});

it('extracts key and ref from the config', () => {
var element = React.createFactory(ComponentClass)({
key: '12',
Expand Down
12 changes: 0 additions & 12 deletions src/isomorphic/classic/element/__tests__/ReactElementClone-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,18 +75,6 @@ describe('ReactElementClone', () => {
expect(ReactDOM.findDOMNode(component).childNodes[0].className).toBe('xyz');
});

it('should warn if the config object inherits from any type other than Object', () => {
spyOn(console, 'error');
React.cloneElement('div', {foo: 1});
expect(console.error).not.toHaveBeenCalled();
React.cloneElement('div', Object.create({foo: 1}));
expect(console.error.calls.count()).toBe(1);
expect(console.error.calls.argsFor(0)[0]).toContain(
'React.cloneElement(...): Expected props argument to be a plain object. ' +
'Properties defined in its prototype chain will be ignored.'
);
});

it('does not fail if config has no prototype', () => {
var config = Object.create(null, {foo: {value: 1, enumerable: true}});
React.cloneElement(<div />, config);
Expand Down

0 comments on commit b2297ae

Please sign in to comment.