FizzTestUtils.js — react Source File
Architecture documentation for FizzTestUtils.js, a javascript file in the react codebase. 0 imports, 8 dependents.
Entity Profile
Dependency Diagram
graph LR 7c063c03_f497_41b6_7547_aff9bc8a9af7["FizzTestUtils.js"] 57d042c3_03d5_3da4_d068_60e598cdee8c["ReactClassComponentPropResolutionFizz-test.js"] 57d042c3_03d5_3da4_d068_60e598cdee8c --> 7c063c03_f497_41b6_7547_aff9bc8a9af7 6cbe5696_b854_e83d_d58b_57025ca7aa7e["ReactDOMFizzDeferredValue-test.js"] 6cbe5696_b854_e83d_d58b_57025ca7aa7e --> 7c063c03_f497_41b6_7547_aff9bc8a9af7 3823a0db_db06_3e81_1da9_46a801b0fef2["ReactDOMFizzForm-test.js"] 3823a0db_db06_3e81_1da9_46a801b0fef2 --> 7c063c03_f497_41b6_7547_aff9bc8a9af7 5072da8a_36b7_45e2_d8f4_8c2953aaa8c8["ReactDOMFizzServer-test.js"] 5072da8a_36b7_45e2_d8f4_8c2953aaa8c8 --> 7c063c03_f497_41b6_7547_aff9bc8a9af7 1c9be272_c194_da44_ae53_7661d361023a["ReactDOMFizzStaticBrowser-test.js"] 1c9be272_c194_da44_ae53_7661d361023a --> 7c063c03_f497_41b6_7547_aff9bc8a9af7 c080373c_9d1b_db13_e832_7d33fe7dc838["ReactDOMFizzSuspenseList-test.js"] c080373c_9d1b_db13_e832_7d33fe7dc838 --> 7c063c03_f497_41b6_7547_aff9bc8a9af7 e87ca5b9_fbce_4b5c_ef2d_28a442469cfb["ReactDOMFizzViewTransition-test.js"] e87ca5b9_fbce_4b5c_ef2d_28a442469cfb --> 7c063c03_f497_41b6_7547_aff9bc8a9af7 3a274a24_5a8b_4696_7509_4a4af5615267["ReactDOMFloat-test.js"] 3a274a24_5a8b_4696_7509_4a4af5615267 --> 7c063c03_f497_41b6_7547_aff9bc8a9af7 style 7c063c03_f497_41b6_7547_aff9bc8a9af7 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
'use strict';
async function insertNodesAndExecuteScripts(
source: Document | Element,
target: Node,
CSPnonce: string | null,
) {
const ownerDocument = target.ownerDocument || target;
// We need to remove the script content for any scripts that would not run based on CSP
// We restore the script content after moving the nodes into the target
const badNonceScriptNodes: Map<Element, string> = new Map();
if (CSPnonce) {
const scripts = source.querySelectorAll('script');
for (let i = 0; i < scripts.length; i++) {
const script = scripts[i];
if (
!script.hasAttribute('src') &&
script.getAttribute('nonce') !== CSPnonce
) {
badNonceScriptNodes.set(script, script.textContent);
script.textContent = '';
}
}
}
let lastChild = null;
while (source.firstChild) {
const node = source.firstChild;
if (lastChild === node) {
throw new Error('Infinite loop.');
}
lastChild = node;
if (node.nodeType === 1) {
const element: Element = (node: any);
if (
// $FlowFixMe[prop-missing]
element.dataset != null &&
(element.dataset.rxi != null ||
element.dataset.rri != null ||
element.dataset.rci != null ||
element.dataset.rsi != null)
) {
// Fizz external runtime instructions are expected to be in the body.
// When we have renderIntoContainer and renderDocument this will be
// more enforceable. At the moment you can misconfigure your stream and end up
// with instructions that are deep in the document
(ownerDocument.body: any).appendChild(element);
} else {
target.appendChild(element);
if (element.nodeName === 'SCRIPT') {
// ... (136 more lines)
Domain
Subdomains
Functions
Imported By
- packages/react-dom/src/__tests__/ReactClassComponentPropResolutionFizz-test.js
- packages/react-dom/src/__tests__/ReactDOMFizzDeferredValue-test.js
- packages/react-dom/src/__tests__/ReactDOMFizzForm-test.js
- packages/react-dom/src/__tests__/ReactDOMFizzServer-test.js
- packages/react-dom/src/__tests__/ReactDOMFizzStaticBrowser-test.js
- packages/react-dom/src/__tests__/ReactDOMFizzSuspenseList-test.js
- packages/react-dom/src/__tests__/ReactDOMFizzViewTransition-test.js
- packages/react-dom/src/__tests__/ReactDOMFloat-test.js
Source
Frequently Asked Questions
What does FizzTestUtils.js do?
FizzTestUtils.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Validation subdomain.
What functions are defined in FizzTestUtils.js?
FizzTestUtils.js defines 5 function(s): executeScript, getVisibleChildren, insertNodesAndExecuteScripts, mergeOptions, stripExternalRuntimeInNodes.
What files import FizzTestUtils.js?
FizzTestUtils.js is imported by 8 file(s): ReactClassComponentPropResolutionFizz-test.js, ReactDOMFizzDeferredValue-test.js, ReactDOMFizzForm-test.js, ReactDOMFizzServer-test.js, ReactDOMFizzStaticBrowser-test.js, ReactDOMFizzSuspenseList-test.js, ReactDOMFizzViewTransition-test.js, ReactDOMFloat-test.js.
Where is FizzTestUtils.js in the architecture?
FizzTestUtils.js is located at packages/react-dom/src/test-utils/FizzTestUtils.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-dom/src/test-utils).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free