Merge pull request #4084 from spicyj/carc

Remove constructAndRenderComponent
This commit is contained in:
Ben Alpert committed 2015-06-22 16:57:52 -07:00
commit 06b88c38f9
3 files changed
-47

No files matched your search

-2
View File
@@ -29,8 +29,6 @@ ReactDefaultInjection.inject();
var render = ReactPerf.measure('React', 'render', ReactMount.render);
var React = {
constructAndRenderComponent: ReactMount.constructAndRenderComponent,
constructAndRenderComponentByID: ReactMount.constructAndRenderComponentByID,
findDOMNode: findDOMNode,
render: render,
unmountComponentAtNode: ReactMount.unmountComponentAtNode,
-33
View File
@@ -595,39 +595,6 @@ var ReactMount = {
return ReactMount._renderSubtreeIntoContainer(null, nextElement, container, callback);
},
/**
* Constructs a component instance of `constructor` with `initialProps` and
* renders it into the supplied `container`.
*
* @param {function} constructor React component constructor.
* @param {?object} props Initial props of the component instance.
* @param {DOMElement} container DOM element to render into.
* @return {ReactComponent} Component instance rendered in `container`.
*/
constructAndRenderComponent: function(constructor, props, container) {
var element = ReactElement.createElement(constructor, props);
return ReactMount.render(element, container);
},
/**
* Constructs a component instance of `constructor` with `initialProps` and
* renders it into a container node identified by supplied `id`.
*
* @param {function} constructor React component constructor
* @param {?object} props Initial props of the component instance.
* @param {string} id ID of the DOM element to render into.
* @return {ReactComponent} Component instance rendered in the container node.
*/
constructAndRenderComponentByID: function(constructor, props, id) {
var domNode = document.getElementById(id);
invariant(
domNode,
'Tried to get element with id of "%s" but it is not present on the page.',
id
);
return ReactMount.constructAndRenderComponent(constructor, props, domNode);
},
/**
* Registers a container node into which React components will be rendered.
* This also creates the "reactRoot" ID that will be assigned to the element
@@ -29,18 +29,6 @@ describe('ReactMount', function() {
// Leave WebComponents undefined.
}
describe('constructAndRenderComponentByID', function() {
it('throws if given an id for a component that doesn\'t exist', function() {
expect(function() {
ReactMount.constructAndRenderComponentByID(
function dummyComponentConstructor() {},
{},
'SOME_ID_THAT_DOESNT_EXIST'
);
}).toThrow();
});
});
describe('unmountComponentAtNode', function() {
it('throws when given a non-node', function() {
var nodeArray = document.getElementsByTagName('div');