[go: up one dir, main page]

Skip to content

Commit

Permalink
ID not Id
Browse files Browse the repository at this point in the history
  • Loading branch information
zpao committed Jul 10, 2015
1 parent 6c0ab0b commit 7032e88
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 27 deletions.
2 changes: 1 addition & 1 deletion src/renderers/dom/client/ReactDOMIDOperations.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ var invariant = require('invariant');
var setInnerHTML = require('setInnerHTML');

/**
* Errors for properties that should not be updated with `updatePropertyById()`.
* Errors for properties that should not be updated with `updatePropertyByID()`.
*
* @type {object}
* @private
Expand Down
10 changes: 5 additions & 5 deletions src/renderers/dom/client/ReactEventListener.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,13 @@ function handleTopLevelWithPath(bookKeeping) {
var currentNativeTarget = path[0];
for (var i = 0; i < path.length; i++) {
var currentPathElement = path[i];
var currentPathElemenId = ReactMount.getID(currentPathElement);
var currentPathElemenID = ReactMount.getID(currentPathElement);
if (currentPathElement.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE) {
currentNativeTarget = path[i + 1];
}
if (ReactMount.isRenderedByReact(currentPathElement)) {
var newRootId = ReactInstanceHandles.getReactRootIDFromNodeID(
currentPathElemenId
var newRootID = ReactInstanceHandles.getReactRootIDFromNodeID(
currentPathElemenID
);
bookKeeping.ancestors.push(currentPathElement);

Expand All @@ -126,10 +126,10 @@ function handleTopLevelWithPath(bookKeeping) {
);

// Jump to the root of this React render tree
while (currentPathElemenId !== newRootId) {
while (currentPathElemenID !== newRootID) {
i++;
currentPathElement = path[i];
currentPathElemenId = ReactMount.getID(currentPathElement);
currentPathElemenID = ReactMount.getID(currentPathElement);
}
}
}
Expand Down
32 changes: 16 additions & 16 deletions src/renderers/shared/reconciler/__tests__/ReactIdentity-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ describe('ReactIdentity', function() {
});

var idExp = /^\.[^.]+(.*)$/;
function checkId(child, expectedId) {
function checkID(child, expectedID) {
var actual = idExp.exec(ReactMount.getID(child));
var expected = idExp.exec(expectedId);
var expected = idExp.exec(expectedID);
expect(actual).toBeTruthy();
expect(expected).toBeTruthy();
expect(actual[1]).toEqual(expected[1]);
Expand All @@ -51,8 +51,8 @@ describe('ReactIdentity', function() {
instance = React.render(instance, document.createElement('div'));
var node = React.findDOMNode(instance);
expect(node.childNodes.length).toBe(2);
checkId(node.childNodes[0], '.0.$first:0');
checkId(node.childNodes[1], '.0.$second:0');
checkID(node.childNodes[0], '.0.$first:0');
checkID(node.childNodes[1], '.0.$second:0');
});

it('should allow key property to express identity', function() {
Expand All @@ -67,10 +67,10 @@ describe('ReactIdentity', function() {
instance = React.render(instance, document.createElement('div'));
var node = React.findDOMNode(instance);
expect(node.childNodes.length).toBe(4);
checkId(node.childNodes[0], '.0.$apple');
checkId(node.childNodes[1], '.0.$banana');
checkId(node.childNodes[2], '.0.$0');
checkId(node.childNodes[3], '.0.$123');
checkID(node.childNodes[0], '.0.$apple');
checkID(node.childNodes[1], '.0.$banana');
checkID(node.childNodes[2], '.0.$0');
checkID(node.childNodes[3], '.0.$123');
});

it('should use instance identity', function() {
Expand All @@ -92,12 +92,12 @@ describe('ReactIdentity', function() {
var node = React.findDOMNode(instance);
expect(node.childNodes.length).toBe(3);

checkId(node.childNodes[0], '.0.$wrap1');
checkId(node.childNodes[0].firstChild, '.0.$wrap1.$squirrel');
checkId(node.childNodes[1], '.0.$wrap2');
checkId(node.childNodes[1].firstChild, '.0.$wrap2.$bunny');
checkId(node.childNodes[2], '.0.2');
checkId(node.childNodes[2].firstChild, '.0.2.$chipmunk');
checkID(node.childNodes[0], '.0.$wrap1');
checkID(node.childNodes[0].firstChild, '.0.$wrap1.$squirrel');
checkID(node.childNodes[1], '.0.$wrap2');
checkID(node.childNodes[1].firstChild, '.0.$wrap2.$bunny');
checkID(node.childNodes[2], '.0.2');
checkID(node.childNodes[2].firstChild, '.0.2.$chipmunk');
});

function renderAComponentWithKeyIntoContainer(key, container) {
Expand All @@ -124,8 +124,8 @@ describe('ReactIdentity', function() {

key = key.replace(/=/g, '=0');

checkId(React.findDOMNode(span1), '.0.$' + key);
checkId(React.findDOMNode(span2), '.0.1:$' + key + ':0');
checkID(React.findDOMNode(span1), '.0.$' + key);
checkID(React.findDOMNode(span2), '.0.1:$' + key + ':0');
}

it('should allow any character as a key, in a detached parent', function() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,21 +189,21 @@ function verifyDomOrderingAccurate(parentInstance, statusDisplays) {
var containerNode = React.findDOMNode(parentInstance);
var statusDisplayNodes = containerNode.childNodes;
var i;
var orderedDomIds = [];
var orderedDomIDs = [];
for (i = 0; i < statusDisplayNodes.length; i++) {
orderedDomIds.push(ReactMount.getID(statusDisplayNodes[i]));
orderedDomIDs.push(ReactMount.getID(statusDisplayNodes[i]));
}

var orderedLogicalIds = [];
var orderedLogicalIDs = [];
var username;
for (username in statusDisplays) {
if (!statusDisplays.hasOwnProperty(username)) {
continue;
}
var statusDisplay = statusDisplays[username];
orderedLogicalIds.push(ReactInstanceMap.get(statusDisplay)._rootNodeID);
orderedLogicalIDs.push(ReactInstanceMap.get(statusDisplay)._rootNodeID);
}
expect(orderedDomIds).toEqual(orderedLogicalIds);
expect(orderedDomIDs).toEqual(orderedLogicalIDs);
}

/**
Expand Down

0 comments on commit 7032e88

Please sign in to comment.