fix: update instanceof check

web-rdp-cloud-fixes
Parkreiner 10 months ago
parent 5ec1b207d1
commit c7a4fced4c

@ -359,12 +359,11 @@ function setupAlwaysOnStyles() {
function hideFormForInitialSubmission() {
const styleId = "coder-patch--styles-initial-submission";
const existingContainer = document.querySelector("#" + styleId);
if (existingContainer) {
return;
}
const styleContainer = document.createElement("style");
/** @type {HTMLStyleElement | null} */
let styleContainer = document.querySelector("#" + styleId);
if (!styleContainer) {
styleContainer = document.createElement("style");
styleContainer.id = styleId;
styleContainer.innerHTML = `
/*
@ -373,8 +372,8 @@ function hideFormForInitialSubmission() {
*/
:root {
/*
Can be 0 or 1. Start off invisible to avoid risks of UI flickering, but
the rest of the function should be in charge of making the form
Can be 0 or 1. Start off invisible to avoid risks of UI flickering,
but the rest of the function should be in charge of making the form
container visible again if something goes wrong during setup.
*/
--coder-opacity-multiplier: 1;
@ -387,13 +386,14 @@ function hideFormForInitialSubmission() {
`;
document.head.appendChild(styleContainer);
}
// The root node being undefined should be physically impossible (if it's
// undefined, the browser itself is busted), but we need to do a type check
// here so that the rest of the function doesn't need to do type checks over
// and over.
const rootNode = document.querySelector(":root");
if (!(rootNode instanceof HTMLElement)) {
if (!(rootNode instanceof HTMLHtmlElement)) {
styleContainer.innerHTML = "";
return;
}

Loading…
Cancel
Save