Update packages/playwright-core/src/server/injected/highlight.ts

Co-authored-by: Dmitry Gozman <dgozman@gmail.com>
Signed-off-by: Max Schmitt <max@schmitt.mx>
This commit is contained in:
Max Schmitt 2024-11-15 17:11:06 +01:00 committed by GitHub
parent 6e229b54d3
commit 64536de5e9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -91,7 +91,7 @@ export class Highlight {
install() { install() {
// NOTE: document.documentElement can be null: https://github.com/microsoft/TypeScript/issues/50078 // 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)) if (!this._injectedScript.document.documentElement?.contains(this._glassPaneElement))
this._injectedScript.document.documentElement.appendChild(this._glassPaneElement); this._injectedScript.document.documentElement.appendChild(this._glassPaneElement);
} }