From 261926303d61b9881670e4ebb8f7a93544c85d14 Mon Sep 17 00:00:00 2001 From: Ben Alpert Date: Tue, 31 Dec 2013 13:37:15 -0700 Subject: [PATCH] Remove sometimes-confusing console error Fixes #767. This essentially reverts 738de8c. We could store some sort of flag to silence the console error here but since we've made significant improvements in markup wrapping, this error is fairly rare now. We'll also have validation of node structure soon in #735. --- src/core/ReactMount.js | 10 ++-------- src/core/__tests__/ReactInstanceHandles-test.js | 8 ++------ 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/src/core/ReactMount.js b/src/core/ReactMount.js index 598c5633fccd4..0a8c3c77707bb 100644 --- a/src/core/ReactMount.js +++ b/src/core/ReactMount.js @@ -576,17 +576,11 @@ var ReactMount = { firstChildren.length = 0; - if (__DEV__) { - console.error( - 'Error while invoking `findComponentRoot` with the following ' + - 'ancestor node:', - ancestorNode - ); - } invariant( false, 'findComponentRoot(..., %s): Unable to find element. This probably ' + - 'means the DOM was unexpectedly mutated (e.g. by the browser).', + 'means the DOM was unexpectedly mutated (e.g., by the browser). ' + + 'Try inspecting the child nodes of the element with React ID `%s`.', id, ReactMount.getID(ancestorNode) ); diff --git a/src/core/__tests__/ReactInstanceHandles-test.js b/src/core/__tests__/ReactInstanceHandles-test.js index 6d665a2b9b235..5f2048f6843f0 100644 --- a/src/core/__tests__/ReactInstanceHandles-test.js +++ b/src/core/__tests__/ReactInstanceHandles-test.js @@ -138,9 +138,6 @@ describe('ReactInstanceHandles', function() { ReactMount.getID(childNodeB) )).toBe(childNodeB); - spyOn(console, 'error'); - expect(console.error.argsForCall.length).toBe(0); - expect(function() { ReactMount.findComponentRoot( parentNode, @@ -149,10 +146,9 @@ describe('ReactInstanceHandles', function() { }).toThrow( 'Invariant Violation: findComponentRoot(..., .react[0].1:0:junk): ' + 'Unable to find element. This probably means the DOM was ' + - 'unexpectedly mutated (e.g. by the browser).' + 'unexpectedly mutated (e.g., by the browser). Try inspecting the ' + + 'child nodes of the element with React ID `.react[0]`.' ); - - expect(console.error.argsForCall.length).toBe(1); }); });