cherry-pick(#33627): fix(codegen): document.documentElement is null on early navigation

This commit is contained in:
Max Schmitt 2024-11-15 17:14:49 +01:00
parent c0fa804367
commit 698823a78e

View file

@ -90,7 +90,8 @@ export class Highlight {
}
install() {
if (!this._injectedScript.document.documentElement.contains(this._glassPaneElement))
// NOTE: document.documentElement can be null: https://github.com/microsoft/TypeScript/issues/50078
if (this._injectedScript.document.documentElement && !this._injectedScript.document.documentElement.contains(this._glassPaneElement))
this._injectedScript.document.documentElement.appendChild(this._glassPaneElement);
}