Skip to content

Commit 39d7bcc

Browse files
committed
refactor: use is to determine whether the element is a dashboard
1 parent 9bc1ebc commit 39d7bcc

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

packages/dashboard/src/vaadin-dashboard-helpers.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,13 +138,15 @@ export function findAncestorInstance(node, baseClass) {
138138
}
139139

140140
/**
141-
* Walks up the DOM tree starting from `node`, returning the first ancestor which extends 'DashboardLayoutMixin'.
141+
* Walks up the DOM tree starting from `node`, returning the first ancestor which is a `Dashboard` or `DashboardLayout`.
142142
*
143143
* @param {Node} node - starting node
144144
* @returns {HTMLElement | null}
145145
*/
146146
export function getParentLayout(node) {
147147
return __findFilteredAncestorInstance(node, (el) => {
148-
return el.constructor && el.constructor.toString().includes('DashboardLayoutMixin');
148+
return (
149+
el.constructor && (el.constructor.is === 'vaadin-dashboard' || el.constructor.is === 'vaadin-dashboard-layout')
150+
);
149151
});
150152
}

0 commit comments

Comments
 (0)