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:
Jim
2015-01-05 13:29:14 -08:00
2 changed files with 6 additions and 6 deletions
+2 -2
View File
@@ -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'
);
});
+4 -4
View File
@@ -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(