From a19aa48f3175bc00e891b050697838f185157be4 Mon Sep 17 00:00:00 2001 From: Shunguo Date: Sun, 27 Oct 2024 21:49:48 -0500 Subject: [PATCH] update DOMWalker #1974 --- accessibility-checker-engine/src/v2/dom/DOMWalker.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/accessibility-checker-engine/src/v2/dom/DOMWalker.ts b/accessibility-checker-engine/src/v2/dom/DOMWalker.ts index aef108ccc..ea53e9b7b 100644 --- a/accessibility-checker-engine/src/v2/dom/DOMWalker.ts +++ b/accessibility-checker-engine/src/v2/dom/DOMWalker.ts @@ -27,7 +27,7 @@ export class DOMWalker { considerHidden: boolean; constructor(element : Node, bEnd? : boolean, root? : Node, considerHidden? : boolean) { - this.root = root || (element.ownerDocument ? element.ownerDocument.documentElement: element); + this.root = root || (element && element.ownerDocument ? element.ownerDocument.documentElement: element); this.node = element; this.bEndTag = (bEnd == undefined ? false : bEnd == true); this.considerHidden = considerHidden || false;