mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Merge pull request #2800 from jsfb/getDOMNode-becomes-findDOMNode
Minor updates to findDOMNode, as per additional post-commit CR feedback.
This commit is contained in:
@@ -42,8 +42,8 @@ describe('findDOMNode', function() {
|
||||
|
||||
it('findDOMNode should reject unmounted objects with render func', function() {
|
||||
expect(function() {React.findDOMNode({render: function(){}});})
|
||||
.toThrow('Invariant Violation: Component contains `render` ' +
|
||||
'method but is not mounted in the DOM'
|
||||
.toThrow('Invariant Violation: Component (with keys: render) ' +
|
||||
'contains `render` method but is not mounted in the DOM'
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -11,8 +11,6 @@
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
var ReactComponent = require('ReactComponent');
|
||||
var ReactInstanceMap = require('ReactInstanceMap');
|
||||
var ReactMount = require('ReactMount');
|
||||
|
||||
@@ -36,8 +34,10 @@ function findDOMNode(componentOrElement) {
|
||||
return ReactMount.getNodeFromInstance(componentOrElement);
|
||||
}
|
||||
invariant(
|
||||
!(componentOrElement.render != null && typeof(componentOrElement.render) === 'function'),
|
||||
'Component contains `render` method but is not mounted in the DOM',
|
||||
componentOrElement.render == null ||
|
||||
typeof(componentOrElement.render) !== 'function',
|
||||
'Component (with keys: %s) contains `render` method '
|
||||
+'but is not mounted in the DOM',
|
||||
Object.keys(componentOrElement)
|
||||
);
|
||||
invariant(
|
||||
|
||||
Reference in New Issue
Block a user