ID not Id
Paul O’Shannessy committed
Jul 9, 2015 at 22:48 UTC
7032e88c25af8daa420ac9e22af8a7ae4f43c7e9
4 files changed
+27
-27
src/renderers/dom/client/ReactDOMIDOperations.js
+1
-1
@@ -22,7 +22,7 @@ var invariant = require('invariant');
22
var setInnerHTML = require('setInnerHTML');
23
24
/**
25
- * Errors for properties that should not be updated with `updatePropertyById()`.
25
+ * Errors for properties that should not be updated with `updatePropertyByID()`.
26
*
27
* @type {object}
28
* @private
src/renderers/dom/client/ReactEventListener.js
+5
-5
@@ -106,13 +106,13 @@ function handleTopLevelWithPath(bookKeeping) {
106
var currentNativeTarget = path[0];
107
for (var i = 0; i < path.length; i++) {
108
var currentPathElement = path[i];
109
- var currentPathElemenId = ReactMount.getID(currentPathElement);
109
+ var currentPathElemenID = ReactMount.getID(currentPathElement);
110
if (currentPathElement.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE) {
111
currentNativeTarget = path[i + 1];
112
}
113
if (ReactMount.isRenderedByReact(currentPathElement)) {
114
- var newRootId = ReactInstanceHandles.getReactRootIDFromNodeID(
115
- currentPathElemenId
114
+ var newRootID = ReactInstanceHandles.getReactRootIDFromNodeID(
115
+ currentPathElemenID
116
);
117
bookKeeping.ancestors.push(currentPathElement);
118
@@ -126,10 +126,10 @@ function handleTopLevelWithPath(bookKeeping) {
126
);
127
128
// Jump to the root of this React render tree
129
- while (currentPathElemenId !== newRootId) {
129
+ while (currentPathElemenID !== newRootID) {
130
i++;
131
currentPathElement = path[i];
132
- currentPathElemenId = ReactMount.getID(currentPathElement);
132
+ currentPathElemenID = ReactMount.getID(currentPathElement);
133
}
134
}
135
}
src/renderers/shared/reconciler/__tests__/ReactIdentity-test.js
+16
-16
@@ -27,9 +27,9 @@ describe('ReactIdentity', function() {
27
});
28
29
var idExp = /^\.[^.]+(.*)$/;
30
- function checkId(child, expectedId) {
30
+ function checkID(child, expectedID) {
31
var actual = idExp.exec(ReactMount.getID(child));
32
- var expected = idExp.exec(expectedId);
32
+ var expected = idExp.exec(expectedID);
33
expect(actual).toBeTruthy();
34
expect(expected).toBeTruthy();
35
expect(actual[1]).toEqual(expected[1]);
@@ -51,8 +51,8 @@ describe('ReactIdentity', function() {
51
instance = React.render(instance, document.createElement('div'));
52
var node = React.findDOMNode(instance);
53
expect(node.childNodes.length).toBe(2);
54
- checkId(node.childNodes[0], '.0.$first:0');
55
- checkId(node.childNodes[1], '.0.$second:0');
54
+ checkID(node.childNodes[0], '.0.$first:0');
55
+ checkID(node.childNodes[1], '.0.$second:0');
56
});
57
58
it('should allow key property to express identity', function() {
@@ -67,10 +67,10 @@ describe('ReactIdentity', function() {
67
instance = React.render(instance, document.createElement('div'));
68
var node = React.findDOMNode(instance);
69
expect(node.childNodes.length).toBe(4);
70
- checkId(node.childNodes[0], '.0.$apple');
71
- checkId(node.childNodes[1], '.0.$banana');
72
- checkId(node.childNodes[2], '.0.$0');
73
- checkId(node.childNodes[3], '.0.$123');
70
+ checkID(node.childNodes[0], '.0.$apple');
71
+ checkID(node.childNodes[1], '.0.$banana');
72
+ checkID(node.childNodes[2], '.0.$0');
73
+ checkID(node.childNodes[3], '.0.$123');
74
});
75
76
it('should use instance identity', function() {
@@ -92,12 +92,12 @@ describe('ReactIdentity', function() {
92
var node = React.findDOMNode(instance);
93
expect(node.childNodes.length).toBe(3);
94
95
- checkId(node.childNodes[0], '.0.$wrap1');
96
- checkId(node.childNodes[0].firstChild, '.0.$wrap1.$squirrel');
97
- checkId(node.childNodes[1], '.0.$wrap2');
98
- checkId(node.childNodes[1].firstChild, '.0.$wrap2.$bunny');
99
- checkId(node.childNodes[2], '.0.2');
100
- checkId(node.childNodes[2].firstChild, '.0.2.$chipmunk');
95
+ checkID(node.childNodes[0], '.0.$wrap1');
96
+ checkID(node.childNodes[0].firstChild, '.0.$wrap1.$squirrel');
97
+ checkID(node.childNodes[1], '.0.$wrap2');
98
+ checkID(node.childNodes[1].firstChild, '.0.$wrap2.$bunny');
99
+ checkID(node.childNodes[2], '.0.2');
100
+ checkID(node.childNodes[2].firstChild, '.0.2.$chipmunk');
101
});
102
103
function renderAComponentWithKeyIntoContainer(key, container) {
@@ -124,8 +124,8 @@ describe('ReactIdentity', function() {
124
125
key = key.replace(/=/g, '=0');
126
127
- checkId(React.findDOMNode(span1), '.0.$' + key);
128
- checkId(React.findDOMNode(span2), '.0.1:$' + key + ':0');
127
+ checkID(React.findDOMNode(span1), '.0.$' + key);
128
+ checkID(React.findDOMNode(span2), '.0.1:$' + key + ':0');
129
}
130
131
it('should allow any character as a key, in a detached parent', function() {
src/renderers/shared/reconciler/__tests__/ReactMultiChildReconcile-test.js
+5
-5
@@ -189,21 +189,21 @@ function verifyDomOrderingAccurate(parentInstance, statusDisplays) {
189
var containerNode = React.findDOMNode(parentInstance);
190
var statusDisplayNodes = containerNode.childNodes;
191
var i;
192
- var orderedDomIds = [];
192
+ var orderedDomIDs = [];
193
for (i = 0; i < statusDisplayNodes.length; i++) {
194
- orderedDomIds.push(ReactMount.getID(statusDisplayNodes[i]));
194
+ orderedDomIDs.push(ReactMount.getID(statusDisplayNodes[i]));
195
}
196
197
- var orderedLogicalIds = [];
197
+ var orderedLogicalIDs = [];
198
var username;
199
for (username in statusDisplays) {
200
if (!statusDisplays.hasOwnProperty(username)) {
201
continue;
202
}
203
var statusDisplay = statusDisplays[username];
204
- orderedLogicalIds.push(ReactInstanceMap.get(statusDisplay)._rootNodeID);
204
+ orderedLogicalIDs.push(ReactInstanceMap.get(statusDisplay)._rootNodeID);
205
}
206
- expect(orderedDomIds).toEqual(orderedLogicalIds);
206
+ expect(orderedDomIDs).toEqual(orderedLogicalIDs);
207
}
208
209
/**