Skip to content

Commit fbf89e9

Browse files
authored
Add sanity check (#115)
1 parent 558885a commit fbf89e9

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/js/tab/tab.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,10 @@
385385
findAncestor(el, tagName) {
386386
let element = el;
387387
while (element.nodeName.toLowerCase() !== tagName) {
388+
// Ensure we haven't reached the top of the dom tree
389+
if (element.parentElement === null) {
390+
return;
391+
}
388392
element = element.parentElement;
389393
}
390394
return element;

0 commit comments

Comments
 (0)