Skip to content

Commit 2a28189

Browse files
committed
Merge pull request #2800 from jsfb/getDOMNode-becomes-findDOMNode
Minor updates to findDOMNode, as per additional post-commit CR feedback.
2 parents a7028c4 + f507ba3 commit 2a28189

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/browser/__tests__/findDOMNode.-test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ describe('findDOMNode', function() {
4242

4343
it('findDOMNode should reject unmounted objects with render func', function() {
4444
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'
4747
);
4848
});
4949

src/browser/findDOMNode.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
*/
1212

1313
"use strict";
14-
15-
var ReactComponent = require('ReactComponent');
1614
var ReactInstanceMap = require('ReactInstanceMap');
1715
var ReactMount = require('ReactMount');
1816

@@ -36,8 +34,10 @@ function findDOMNode(componentOrElement) {
3634
return ReactMount.getNodeFromInstance(componentOrElement);
3735
}
3836
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',
4141
Object.keys(componentOrElement)
4242
);
4343
invariant(

0 commit comments

Comments
 (0)