Use const/let in more places (#11467)

* Convert ReactDOM to const/let
* Convert ReactDOMComponentTree to const/let
* Convert ReactDOMComponentTree to const/let
* Convert getNodeForCharacterOffset to const/let
* Convert getTextContentAccessor to const/let
* Convert inputValueTracking to const/let
* Convert setInnerHTML to const/let
* Convert setTextContent to const/let
* Convert validateDOMNesting to const/let
This commit is contained in:
Raphael Amorim
2017-11-06 09:30:03 -02:00
committed by Dan Abramov
parent 1d1f7038ec
commit bb3c22c66f
9 changed files with 59 additions and 58 deletions
+7 -7
View File
@@ -8,9 +8,9 @@
import {HostComponent, HostText} from 'shared/ReactTypeOfWork';
import invariant from 'fbjs/lib/invariant';
var randomKey = Math.random().toString(36).slice(2);
var internalInstanceKey = '__reactInternalInstance$' + randomKey;
var internalEventHandlersKey = '__reactEventHandlers$' + randomKey;
const randomKey = Math.random().toString(36).slice(2);
const internalInstanceKey = '__reactInternalInstance$' + randomKey;
const internalEventHandlersKey = '__reactEventHandlers$' + randomKey;
export function precacheFiberNode(hostInst, node) {
node[internalInstanceKey] = hostInst;
@@ -26,7 +26,7 @@ export function getClosestInstanceFromNode(node) {
}
// Walk up the tree until we find an ancestor whose instance we have cached.
var parents = [];
let parents = [];
while (!node[internalInstanceKey]) {
parents.push(node);
if (node.parentNode) {
@@ -38,8 +38,8 @@ export function getClosestInstanceFromNode(node) {
}
}
var closest;
var inst = node[internalInstanceKey];
let closest;
let inst = node[internalInstanceKey];
if (inst.tag === HostComponent || inst.tag === HostText) {
// In Fiber, this will always be the deepest root.
return inst;
@@ -56,7 +56,7 @@ export function getClosestInstanceFromNode(node) {
* instance, or null if the node was not rendered by this React.
*/
export function getInstanceFromNode(node) {
var inst = node[internalInstanceKey];
const inst = node[internalInstanceKey];
if (inst) {
if (inst.tag === HostComponent || inst.tag === HostText) {
return inst;