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

This commit is contained in:
Max Schmitt 2024-11-15 17:14:49 +01:00 committed by GitHub
parent e61cea597a
commit c81504c5d6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 1 deletions

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);
}