@samitouri / QOS-React / commits / 046f7448d7

Two minor changes from internal (#8855)

Ben Alpert committed Jan 23, 2017 at 17:11 UTC 046f7448d7224da5b33441248a32a319a6464bc5
2 files changed +14 -17
src/renderers/dom/fiber/ReactDOMFiberComponent.js
+1 -1
@@ -465,7 +465,7 @@ var ReactDOMFiberComponent = {
465 // Create the script via .innerHTML so its "parser-inserted" flag is
466 // set to true and it does not execute
467 var div = ownerDocument.createElement('div');
468 - div.innerHTML = '<script></script>';
468 + div.innerHTML = '<script><' + '/script>'; // eslint-disable-line
469 // This is guaranteed to yield a script element.
470 var firstChild = ((div.firstChild : any) : HTMLScriptElement);
471 domElement = div.removeChild(firstChild);
src/shared/utils/getComponentName.js
+13 -16
@@ -16,25 +16,22 @@ import type { ReactInstance } from 'ReactInstanceType';
16 import type { Fiber } from 'ReactFiber';
17
18 function getComponentName(instanceOrFiber : ReactInstance | Fiber) : string | null {
19 - if (__DEV__) {
20 - if (typeof instanceOrFiber.getName === 'function') {
21 - // Stack reconciler
22 - const instance = ((instanceOrFiber : any) : ReactInstance);
23 - return instance.getName() || 'Component';
19 + if (typeof instanceOrFiber.getName === 'function') {
20 + // Stack reconciler
21 + const instance = ((instanceOrFiber : any) : ReactInstance);
22 + return instance.getName() || 'Component';
23 + }
24 + if (typeof instanceOrFiber.tag === 'number') {
25 + // Fiber reconciler
26 + const fiber = ((instanceOrFiber : any) : Fiber);
27 + const {type} = fiber;
28 + if (typeof type === 'string') {
29 + return type;
30 }
25 - if (typeof instanceOrFiber.tag === 'number') {
26 - // Fiber reconciler
27 - const fiber = ((instanceOrFiber : any) : Fiber);
28 - const {type} = fiber;
29 - if (typeof type === 'string') {
30 - return type;
31 - }
32 - if (typeof type === 'function') {
33 - return type.displayName || type.name || null;
34 - }
31 + if (typeof type === 'function') {
32 + return type.displayName || type.name || null;
33 }
34 }
37 - return null;
35 }
36
37 module.exports = getComponentName;