Minor updates to findDOMNode, as per additional post-commit CR feedback.
Jim committed
Jan 2, 2015 at 12:31 UTC
f507ba3c2b667b41b9037166295c2ae5e80e748d
2 files changed
+6
-6
src/browser/__tests__/findDOMNode.-test.js
+2
-2
@@ -42,8 +42,8 @@ describe('findDOMNode', function() {
42
43
it('findDOMNode should reject unmounted objects with render func', function() {
44
expect(function() {React.findDOMNode({render: function(){}});})
45
- .toThrow('Invariant Violation: Component contains `render` ' +
46
- 'method but is not mounted in the DOM'
45
+ .toThrow('Invariant Violation: Component (with keys: render) ' +
46
+ 'contains `render` method but is not mounted in the DOM'
47
);
48
});
49
src/browser/findDOMNode.js
+4
-4
@@ -11,8 +11,6 @@
11
*/
12
13
"use strict";
14
-
15
-var ReactComponent = require('ReactComponent');
14
var ReactInstanceMap = require('ReactInstanceMap');
15
var ReactMount = require('ReactMount');
16
@@ -36,8 +34,10 @@ function findDOMNode(componentOrElement) {
34
return ReactMount.getNodeFromInstance(componentOrElement);
35
}
36
invariant(
39
- !(componentOrElement.render != null && typeof(componentOrElement.render) === 'function'),
40
- 'Component contains `render` method but is not mounted in the DOM',
37
+ componentOrElement.render == null ||
38
+ typeof(componentOrElement.render) !== 'function',
39
+ 'Component (with keys: %s) contains `render` method '
40
+ +'but is not mounted in the DOM',
41
Object.keys(componentOrElement)
42
);
43
invariant(