getSiblings.js
Get all siblings of an element.
Works in all modern browsers, and at least back to IE9.
/*!
* Get all siblings of an element
* (c) 2018 Chris Ferdinandi, MIT License, https://gomakethings.com
* @param {Node} elem The element
* @return {Array} The siblings
*/
var getSiblings = function (elem) {
return Array.prototype.filter.call(elem.parentNode.children, function (sibling) {
return sibling !== elem;
});
};