From d35add2dd2aae54dbbce7b6d4f558d4ed804638a Mon Sep 17 00:00:00 2001 From: kjimlau Date: Mon, 27 Sep 2021 23:28:13 +0800 Subject: [PATCH] fix: getDomQueryPath hasAttribute --- src/utils/dom.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/dom.ts b/src/utils/dom.ts index d743818..2d857b3 100644 --- a/src/utils/dom.ts +++ b/src/utils/dom.ts @@ -41,7 +41,7 @@ export function getDomQueryPath(el: HTMLElement) { } } const name = el.nodeName.toLowerCase(); - if (el.hasAttribute("id") && el.id != "") { + if (typeof el.hasAttribute === 'function' && el.hasAttribute("id") && el.id != "") { stack.unshift(`${name}#${el.id}`); } else if (sibCount > 1) { stack.unshift(`${name}:nth-of-type(${sibIndex + 1})`);