Fix #57 split on undefined error
This commit is contained in:
parent
61bf3cf354
commit
cdf0903583
1 changed files with 2 additions and 1 deletions
|
@ -4,7 +4,8 @@
|
|||
* @param {string} className
|
||||
*/
|
||||
export const insideClass = (element, className) => {
|
||||
if (element.className.split(" ").includes(className)) return element;
|
||||
if (element.className && element.className.split(" ").includes(className))
|
||||
return element;
|
||||
if (!element.parentNode) return false;
|
||||
return element.parentNode && insideClass(element.parentNode, className);
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue