Skip to content

Commit

Permalink
Merge pull request #617 from capricorn86/task/467-cannot-read-propert…
Browse files Browse the repository at this point in the history
…ies-of-undefined-reading-getrootnode

#467@patch: Adds check for if the active element is of type Element b…
  • Loading branch information
capricorn86 committed Oct 12, 2022
2 parents 051c4d9 + 2008379 commit 00abde9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/happy-dom/src/nodes/document/Document.ts
Expand Up @@ -349,7 +349,7 @@ export default class Document extends Node implements IDocument {
this._activeElement = null;
}

if (this._activeElement) {
if (this._activeElement && this._activeElement instanceof Element) {
let rootNode: IShadowRoot | IDocument = <IShadowRoot | IDocument>(
this._activeElement.getRootNode()
);
Expand Down

0 comments on commit 00abde9

Please sign in to comment.