Skip to content

Commit 56700e5

Browse files
fix(core): add check for HTMLSlotElement support (#7840)
* Add check for slot support * getWindow --------- Co-authored-by: Vladimir Kharlampidi <[email protected]>
1 parent 69113c9 commit 56700e5

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/shared/utils.mjs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,9 @@ function findElementsInElements(elements = [], selector = '') {
203203
return found;
204204
}
205205
function elementChildren(element, selector = '') {
206+
const window = getWindow();
206207
const children = [...element.children];
207-
if (element instanceof HTMLSlotElement) {
208+
if (window.HTMLSlotElement && element instanceof HTMLSlotElement) {
208209
children.push(...element.assignedElements());
209210
}
210211

@@ -229,8 +230,9 @@ function elementIsChildOfSlot(el, slot) {
229230
}
230231
}
231232
function elementIsChildOf(el, parent) {
233+
const window = getWindow();
232234
let isChild = parent.contains(el);
233-
if (!isChild && parent instanceof HTMLSlotElement) {
235+
if (!isChild && window.HTMLSlotElement && parent instanceof HTMLSlotElement) {
234236
const children = [...parent.assignedElements()];
235237
isChild = children.includes(el);
236238
if (!isChild) {

0 commit comments

Comments
 (0)