reading a few questions on here, and reading through the docs: I'm still a bit confused about how to fix this warning of no-loop-func:
function scrollHorizontally(e,listOfBannedClasses, parentClass){
//truncated example
let target = e.target;
while(target.parentNode!== null && target.className!==parentClass &&target.parentNode!== undefined){
if(listOfBannedClasses.some(x=>target.parentNode.classList.contains(x)))
{
return;
}
target = target.parentNode;
}
}
I understand that the problem stems from target being defined outside the while loop. but I'm not using a function of any kind to reassign it: it just walks up a node tree. what I am trying to do is to get the highest element of the DOM tree possible that is below a 'banned class' from the element clicked on.
is there a cleaner way of doing that then this code?