mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
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:
committed by
Dan Abramov
parent
1d1f7038ec
commit
bb3c22c66f
+7
-7
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user