Test if parent is not null before testing classList

Closes #15152
(grafted from 45cf3086a1f63732e3298845a1fa183375ec76b4)

--HG--
branch : 8.2
This commit is contained in:
Cédric Krier
2026-10-06 13:12:24 +02:00
parent 60c5684c27
commit cb6804c1e1
+1 -1
View File
@@ -96,7 +96,7 @@
}
parent = parent.parentElement;
}
if (!parent.classList.contains('modal')) {
if (parent && !parent.classList.contains('modal')) {
ancestors.push(window);
}
return ancestors;