Iframe.js — react Source File
Architecture documentation for Iframe.js, a javascript file in the react codebase. 0 imports, 2 dependents.
Entity Profile
Dependency Diagram
graph LR 70b5253e_813d_8b9b_6dca_779425403139["Iframe.js"] 7680536c_c07f_3727_61d8_e447a4d8d88e["OnSelectEventTestCase.js"] 7680536c_c07f_3727_61d8_e447a4d8d88e --> 70b5253e_813d_8b9b_6dca_779425403139 209c92e7_f698_d039_e163_bf03ab022808["ReorderedInputsTestCase.js"] 209c92e7_f698_d039_e163_bf03ab022808 --> 70b5253e_813d_8b9b_6dca_779425403139 style 70b5253e_813d_8b9b_6dca_779425403139 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
const React = window.React;
const ReactDOM = window.ReactDOM;
class IframePortal extends React.Component {
iframeRef = null;
handleRef = ref => {
if (ref !== this.iframeRef) {
this.iframeRef = ref;
if (ref) {
if (ref.contentDocument && this.props.head) {
ref.contentDocument.head.innerHTML = this.props.head;
}
// Re-render must take place in the next tick (Firefox)
setTimeout(() => {
this.forceUpdate();
});
}
}
};
render() {
const ref = this.iframeRef;
let portal = null;
if (ref && ref.contentDocument) {
portal = ReactDOM.createPortal(
this.props.children,
ref.contentDocument.body
);
}
return (
<div>
<iframe
title="Iframe portal"
style={{border: 'none', height: this.props.height}}
ref={this.handleRef}
/>
{portal}
</div>
);
}
}
class IframeSubtree extends React.Component {
warned = false;
render() {
if (!this.warned) {
console.error(
`IFrame has not yet been implemented for React v${React.version}`
);
this.warned = true;
}
return <div>{this.props.children}</div>;
}
}
export default ReactDOM.createPortal ? IframePortal : IframeSubtree;
Domain
Subdomains
Classes
Imported By
Source
Frequently Asked Questions
What does Iframe.js do?
Iframe.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Optimization subdomain.
What files import Iframe.js?
Iframe.js is imported by 2 file(s): OnSelectEventTestCase.js, ReorderedInputsTestCase.js.
Where is Iframe.js in the architecture?
Iframe.js is located at fixtures/dom/src/components/Iframe.js (domain: BabelCompiler, subdomain: Optimization, directory: fixtures/dom/src/components).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free