mirror of
https://github.com/facebook/react.git
synced 2026-02-24 20:53:03 +00:00
* Enable prefer-const rule Stylistically I don't like this but Closure Compiler takes advantage of this information. * Auto-fix lints * Manually fix the remaining callsites
20 lines
626 B
JavaScript
20 lines
626 B
JavaScript
// Portal target container.
|
|
window.container = document.getElementById('container');
|
|
|
|
let hasInjectedStyles = false;
|
|
|
|
// DevTools styles are injected into the top-level document head (where the main React app is rendered).
|
|
// This method copies those styles to the child window where each panel (e.g. Elements, Profiler) is portaled.
|
|
window.injectStyles = getLinkTags => {
|
|
if (!hasInjectedStyles) {
|
|
hasInjectedStyles = true;
|
|
|
|
const linkTags = getLinkTags();
|
|
|
|
// eslint-disable-next-line no-for-of-loops/no-for-of-loops
|
|
for (const linkTag of linkTags) {
|
|
document.head.appendChild(linkTag);
|
|
}
|
|
}
|
|
};
|