Two minor changes from internal (#8855)

This commit is contained in:
Ben Alpert
2017-01-23 17:11:10 -08:00
committed by GitHub
parent eb89bc4c30
commit 046f7448d7
2 changed files with 14 additions and 17 deletions
@@ -465,7 +465,7 @@ var ReactDOMFiberComponent = {
// Create the script via .innerHTML so its "parser-inserted" flag is
// set to true and it does not execute
var div = ownerDocument.createElement('div');
div.innerHTML = '<script></script>';
div.innerHTML = '<script><' + '/script>'; // eslint-disable-line
// This is guaranteed to yield a script element.
var firstChild = ((div.firstChild : any) : HTMLScriptElement);
domElement = div.removeChild(firstChild);
+13 -16
View File
@@ -16,25 +16,22 @@ import type { ReactInstance } from 'ReactInstanceType';
import type { Fiber } from 'ReactFiber';
function getComponentName(instanceOrFiber : ReactInstance | Fiber) : string | null {
if (__DEV__) {
if (typeof instanceOrFiber.getName === 'function') {
// Stack reconciler
const instance = ((instanceOrFiber : any) : ReactInstance);
return instance.getName() || 'Component';
if (typeof instanceOrFiber.getName === 'function') {
// Stack reconciler
const instance = ((instanceOrFiber : any) : ReactInstance);
return instance.getName() || 'Component';
}
if (typeof instanceOrFiber.tag === 'number') {
// Fiber reconciler
const fiber = ((instanceOrFiber : any) : Fiber);
const {type} = fiber;
if (typeof type === 'string') {
return type;
}
if (typeof instanceOrFiber.tag === 'number') {
// Fiber reconciler
const fiber = ((instanceOrFiber : any) : Fiber);
const {type} = fiber;
if (typeof type === 'string') {
return type;
}
if (typeof type === 'function') {
return type.displayName || type.name || null;
}
if (typeof type === 'function') {
return type.displayName || type.name || null;
}
}
return null;
}
module.exports = getComponentName;