Skip to content

Instantly share code, notes, and snippets.

@wking-io
Created October 11, 2017 19:43
Show Gist options
  • Select an option

  • Save wking-io/69f537844deb5cbff248cb5346fb00b0 to your computer and use it in GitHub Desktop.

Select an option

Save wking-io/69f537844deb5cbff248cb5346fb00b0 to your computer and use it in GitHub Desktop.
How can I transform siblings of an element?
const transformSibs = (el, callback) => Array
.from(el.parentNode.childNodes)
.filter(child => child.nodeType == 1 && child != el)
.forEach(sibling => {
callback(sibling);
return sibling;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment