From 602a863d892507c39469f49e706f14081e1944d8 Mon Sep 17 00:00:00 2001 From: Tao Cumplido Date: Thu, 24 Nov 2022 19:33:33 +0100 Subject: [PATCH] fix isTreeItem method when called with non-element nodes (#1026) --- src/components/tree-item/tree-item.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/tree-item/tree-item.ts b/src/components/tree-item/tree-item.ts index 9a7fccbdd..63e0f19c6 100644 --- a/src/components/tree-item/tree-item.ts +++ b/src/components/tree-item/tree-item.ts @@ -14,8 +14,8 @@ import '../spinner/spinner'; import styles from './tree-item.styles'; import type { CSSResultGroup, PropertyValueMap } from 'lit'; -export function isTreeItem(element: Element) { - return element && element?.getAttribute('role') === 'treeitem'; +export function isTreeItem(node: Node) { + return node instanceof Element && node.getAttribute('role') === 'treeitem'; } /**