What is the perfect way to find all nextSiblings and previousSiblings in JavaScript. I tried few ways but not getting accurate solution. If any element is selected, I need t
back to 2017: Maybe there is a better answer but that good and a little bit cleaner
function sibiling(dom, query) { var doms = dom.parentElement.querySelectorAll(query); return [].slice.call(doms).filter( d => d != dom); }