Merge pull request #4422 from jimfb/reconciler-cleanup

Cleaned up a few names in the reconciler.
This commit is contained in:
Jim
2015-07-27 15:59:44 -07:00
2 changed files with 14 additions and 15 deletions
@@ -64,7 +64,7 @@ var ReactChildReconciler = {
* Updates the rendered children and returns a new set of children.
*
* @param {?object} prevChildren Previously initialized set of children.
* @param {?object} nextNestedChildNodes Nested child maps.
* @param {?object} nextNestedChildrenElements Nested child element maps.
* @param {ReactReconcileTransaction} transaction
* @param {object} context
* @return {?object} A new set of child instances.
@@ -72,7 +72,7 @@ var ReactChildReconciler = {
*/
updateChildren: function(
prevChildren,
nextNestedChildNodes,
nextNestedChildrenElements,
transaction,
context) {
// We currently don't have a way to track moves here but if we use iterators
@@ -80,7 +80,7 @@ var ReactChildReconciler = {
// moved.
// TODO: If nothing has changed, return the prevChildren object so that we
// can quickly bailout if nothing has changed.
var nextChildren = flattenChildren(nextNestedChildNodes);
var nextChildren = flattenChildren(nextNestedChildrenElements);
if (!nextChildren && !prevChildren) {
return null;
}
@@ -239,7 +239,7 @@ var ReactMultiChild = {
// TODO: The setTextContent operation should be enough
for (var name in prevChildren) {
if (prevChildren.hasOwnProperty(name)) {
this._unmountChildByName(prevChildren[name], name);
this._unmountChild(prevChildren[name]);
}
}
// Set new text content.
@@ -292,15 +292,15 @@ var ReactMultiChild = {
/**
* Updates the rendered children with new children.
*
* @param {?object} nextNestedChildren Nested child maps.
* @param {?object} nextNestedChildrenElements Nested child element maps.
* @param {ReactReconcileTransaction} transaction
* @internal
*/
updateChildren: function(nextNestedChildren, transaction, context) {
updateChildren: function(nextNestedChildrenElements, transaction, context) {
updateDepth++;
var errorThrown = true;
try {
this._updateChildren(nextNestedChildren, transaction, context);
this._updateChildren(nextNestedChildrenElements, transaction, context);
errorThrown = false;
} finally {
updateDepth--;
@@ -319,15 +319,15 @@ var ReactMultiChild = {
* Improve performance by isolating this hot code path from the try/catch
* block in `updateChildren`.
*
* @param {?object} nextNestedChildren Nested child maps.
* @param {?object} nextNestedChildrenElements Nested child element maps.
* @param {ReactReconcileTransaction} transaction
* @final
* @protected
*/
_updateChildren: function(nextNestedChildren, transaction, context) {
_updateChildren: function(nextNestedChildrenElements, transaction, context) {
var prevChildren = this._renderedChildren;
var nextChildren = ReactChildReconciler.updateChildren(
prevChildren, nextNestedChildren, transaction, context
prevChildren, nextNestedChildrenElements, transaction, context
);
this._renderedChildren = nextChildren;
if (!nextChildren && !prevChildren) {
@@ -352,7 +352,7 @@ var ReactMultiChild = {
if (prevChild) {
// Update `lastIndex` before `_mountIndex` gets unset by unmounting.
lastIndex = Math.max(prevChild._mountIndex, lastIndex);
this._unmountChildByName(prevChild, name);
this._unmountChild(prevChild);
}
// The child must be instantiated before it's mounted.
this._mountChildByNameAtIndex(
@@ -365,7 +365,7 @@ var ReactMultiChild = {
for (name in prevChildren) {
if (prevChildren.hasOwnProperty(name) &&
!(nextChildren && nextChildren.hasOwnProperty(name))) {
this._unmountChildByName(prevChildren[name], name);
this._unmountChild(prevChildren[name]);
}
}
},
@@ -470,15 +470,14 @@ var ReactMultiChild = {
},
/**
* Unmounts a rendered child by name.
* Unmounts a rendered child.
*
* NOTE: This is part of `updateChildren` and is here for readability.
*
* @param {ReactComponent} child Component to unmount.
* @param {string} name Name of the child in `this._renderedChildren`.
* @private
*/
_unmountChildByName: function(child, name) {
_unmountChild: function(child) {
this.removeChild(child);
child._mountIndex = null;
},