Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove full page rendering and restrict rendering into head #585

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 1 addition & 14 deletions src/core/ReactComponentBrowserEnvironment.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,9 @@ var ReactReconcileTransaction = require('ReactReconcileTransaction');

var getReactRootElementInContainer = require('getReactRootElementInContainer');
var invariant = require('invariant');
var mutateHTMLNodeWithMarkup = require('mutateHTMLNodeWithMarkup');


var ELEMENT_NODE_TYPE = 1;
var DOC_NODE_TYPE = 9;


/**
Expand Down Expand Up @@ -82,10 +80,7 @@ var ReactComponentBrowserEnvironment = {
*/
mountImageIntoNode: function(markup, container, shouldReuseMarkup) {
invariant(
container && (
container.nodeType === ELEMENT_NODE_TYPE ||
container.nodeType === DOC_NODE_TYPE && ReactMount.allowFullPageRender
),
container && container.nodeType === ELEMENT_NODE_TYPE,
'mountComponentIntoNode(...): Target container is not valid.'
);
if (shouldReuseMarkup) {
Expand All @@ -108,14 +103,6 @@ var ReactComponentBrowserEnvironment = {
}
}

// You can't naively set the innerHTML of the entire document. You need
// to mutate documentElement which requires doing some crazy tricks. See
// mutateHTMLNodeWithMarkup()
if (container.nodeType === DOC_NODE_TYPE) {
mutateHTMLNodeWithMarkup(container.documentElement, markup);
return;
}

// Asynchronously inject markup by ensuring that the container is not in
// the document when settings its `innerHTML`.
var parent = container.parentNode;
Expand Down
17 changes: 3 additions & 14 deletions src/core/ReactMount.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ var ATTR_NAME = 'data-reactid';
var nodeCache = {};

var ELEMENT_NODE_TYPE = 1;
var DOC_NODE_TYPE = 9;

/** Mapping from reactRootID to React component instance. */
var instancesByReactRootID = {};
Expand Down Expand Up @@ -175,11 +174,6 @@ function purgeID(id) {
* Inside of `container`, the first element rendered is the "reactRoot".
*/
var ReactMount = {
/**
* Safety guard to prevent accidentally rendering over the entire HTML tree.
*/
allowFullPageRender: false,

/** Time spent generating markup. */
totalInstantiationTime: 0,

Expand Down Expand Up @@ -213,10 +207,9 @@ var ReactMount = {
*/
prepareEnvironmentForDOM: function(container) {
invariant(
container && (
container.nodeType === ELEMENT_NODE_TYPE ||
container.nodeType === DOC_NODE_TYPE
),
container &&
container.nodeType === ELEMENT_NODE_TYPE &&
container.tagName !== 'HEAD',
'prepareEnvironmentForDOM(...): Target container is not a DOM element.'
);
var doc = container.nodeType === ELEMENT_NODE_TYPE ?
Expand Down Expand Up @@ -431,10 +424,6 @@ var ReactMount = {
unmountComponentFromNode: function(instance, container) {
instance.unmountComponent();

if (container.nodeType === DOC_NODE_TYPE) {
container = container.documentElement;
}

// http://jsperf.com/emptying-a-node
while (container.lastChild) {
container.removeChild(container.lastChild);
Expand Down
273 changes: 0 additions & 273 deletions src/core/__tests__/ReactRenderDocument-test.js

This file was deleted.

Loading